зеркало из https://github.com/mozilla/pjs.git
checkpoint
This commit is contained in:
Родитель
a75faa4224
Коммит
6c742e94ff
|
@ -78,7 +78,7 @@
|
|||
</target>
|
||||
|
||||
<target name="main"
|
||||
depends="prepare,compile.classes,compile.src,compile.jni,compile.examples"/>
|
||||
depends="prepare,compile.classes,compile.src,compile.jni,compile.mozilla,compile.examples"/>
|
||||
|
||||
<target name="compile.classes">
|
||||
|
||||
|
@ -122,6 +122,17 @@
|
|||
|
||||
</target>
|
||||
|
||||
<target name="compile.mozilla">
|
||||
|
||||
<exec os="SunOS" dir="${basedir}/mozilla" failonerror="yes"
|
||||
executable="gmake"/>
|
||||
<exec os="Linux" dir="${basedir}/mozilla" failonerror="yes"
|
||||
executable="make"/>
|
||||
<exec os="Windows 2000" dir="${basedir}/mozilla" executable="make"
|
||||
failonerror="yes"/>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="clean.classes">
|
||||
<delete dir="${build.home}/org/mozilla/pluglets"/>
|
||||
</target>
|
||||
|
@ -134,13 +145,18 @@
|
|||
</fileset>
|
||||
</delete>
|
||||
|
||||
|
||||
<delete >
|
||||
<fileset dir="${basedir}/jni">
|
||||
<include name="*.ilk"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
<delete >
|
||||
<fileset dir="${basedir}/mozilla">
|
||||
<include name="*.ilk"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
<exec os="SunOS" dir="${basedir}/src" executable="gmake"
|
||||
failonerror="yes">
|
||||
<arg line="clobber_all"/>
|
||||
|
@ -169,6 +185,20 @@
|
|||
<arg line="clobber_all"/>
|
||||
</exec>
|
||||
|
||||
<exec os="SunOS" dir="${basedir}/mozilla" executable="gmake"
|
||||
failonerror="yes">
|
||||
<arg line="clobber_all"/>
|
||||
</exec>
|
||||
<exec os="Linux" dir="${basedir}/mozilla" executable="make"
|
||||
failonerror="yes">
|
||||
<arg line="clobber_all"/>
|
||||
</exec>
|
||||
<exec os="Windows 2000" dir="${basedir}/mozilla" executable="make"
|
||||
failonerror="yes">
|
||||
<arg line="clobber_all"/>
|
||||
</exec>
|
||||
|
||||
|
||||
</target>
|
||||
|
||||
<target name="compile.examples" depends="compile.classes">
|
||||
|
|
|
@ -38,11 +38,15 @@
|
|||
#include "nppluglet.h"
|
||||
|
||||
#include "PlugletLoader.h"
|
||||
#include "iPlugletEngine.h"
|
||||
#include "nsIPlugin.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIMemory.h"
|
||||
#include "nsISupportsUtils.h" // this is where some useful macros defined
|
||||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
// service manager which will give the access to all public browser services
|
||||
// we will use memory service as an illustration
|
||||
nsIServiceManager * gServiceManager = NULL;
|
||||
|
@ -95,19 +99,18 @@ NPError NS_PluginInitialize()
|
|||
// in the future so we don't need to do casting of any sort.
|
||||
if(sm) {
|
||||
sm->QueryInterface(NS_GET_IID(nsIServiceManager), (void**)&gServiceManager);
|
||||
printf("debug: edburns: gServiceManager: %p\n\n", gServiceManager);
|
||||
NS_RELEASE(sm);
|
||||
}
|
||||
|
||||
PlugletLoader::Initialize();
|
||||
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
void NS_PluginShutdown()
|
||||
{
|
||||
|
||||
PlugletLoader::Destroy();
|
||||
|
||||
// we should release the service manager
|
||||
NS_IF_RELEASE(gServiceManager);
|
||||
gServiceManager = NULL;
|
||||
|
@ -119,11 +122,24 @@ void NS_PluginShutdown()
|
|||
//
|
||||
nsPluginInstanceBase * NS_NewPluginInstance(nsPluginCreateData * aCreateDataStruct)
|
||||
{
|
||||
if(!aCreateDataStruct)
|
||||
return NULL;
|
||||
|
||||
nsPluginInstance * plugin = new nsPluginInstance(aCreateDataStruct->instance);
|
||||
return plugin;
|
||||
nsPluginInstance * result = nsnull;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if(aCreateDataStruct) {
|
||||
result = new nsPluginInstance(aCreateDataStruct);
|
||||
PRBool isSupported = PR_FALSE;
|
||||
rv = result->HasPlugletForMimeType(aCreateDataStruct->type,
|
||||
&isSupported);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (!isSupported) {
|
||||
result = nsnull;
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void NS_DestroyPluginInstance(nsPluginInstanceBase * aPlugin)
|
||||
|
@ -136,11 +152,17 @@ void NS_DestroyPluginInstance(nsPluginInstanceBase * aPlugin)
|
|||
//
|
||||
// nsPluginInstance class implementation
|
||||
//
|
||||
nsPluginInstance::nsPluginInstance(NPP aInstance) : nsPluginInstanceBase(),
|
||||
mInstance(aInstance),
|
||||
nsPluginInstance::nsPluginInstance(nsPluginCreateData * aCreateDataStruct) : nsPluginInstanceBase(),
|
||||
mInstance(aCreateDataStruct->instance),
|
||||
mInitialized(FALSE),
|
||||
mScriptablePeer(NULL)
|
||||
{
|
||||
mCreateDataStruct.instance = aCreateDataStruct->instance;
|
||||
mCreateDataStruct.type = aCreateDataStruct->type;
|
||||
mCreateDataStruct.mode = aCreateDataStruct->mode;
|
||||
mCreateDataStruct.argc = aCreateDataStruct->argc;
|
||||
mCreateDataStruct.argn = aCreateDataStruct->argn;
|
||||
mCreateDataStruct.saved = aCreateDataStruct->saved;
|
||||
mString[0] = '\0';
|
||||
}
|
||||
|
||||
|
@ -173,6 +195,29 @@ NPBool nsPluginInstance::isInitialized()
|
|||
return mInitialized;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstance::HasPlugletForMimeType(const char *aMimeType,
|
||||
PRBool *outResult)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIPlugin> pluglet =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);
|
||||
void *outInstance = nsnull;
|
||||
*outResult = PR_FALSE;
|
||||
nsIID scriptableIID = NS_ISIMPLEPLUGIN_IID;
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = pluglet->CreatePluginInstance(nsnull, scriptableIID,
|
||||
aMimeType, &outInstance);
|
||||
if (NS_SUCCEEDED(rv) && outInstance) {
|
||||
*outResult = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ==============================
|
||||
// ! Scriptability related code !
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
class nsPluginInstance : public nsPluginInstanceBase
|
||||
{
|
||||
public:
|
||||
nsPluginInstance(NPP aInstance);
|
||||
nsPluginInstance(nsPluginCreateData * aCreateDataStruct);
|
||||
~nsPluginInstance();
|
||||
|
||||
NPBool init(NPWindow* aWindow);
|
||||
|
@ -57,6 +57,7 @@ public:
|
|||
NPError GetValue(NPPVariable variable, void *value);
|
||||
|
||||
// locals
|
||||
NS_IMETHOD HasPlugletForMimeType(const char *aMimeType, PRBool *outResult);
|
||||
|
||||
nsScriptablePeer* getScriptablePeer();
|
||||
|
||||
|
@ -64,6 +65,7 @@ private:
|
|||
NPP mInstance;
|
||||
NPBool mInitialized;
|
||||
nsScriptablePeer * mScriptablePeer;
|
||||
nsPluginCreateData mCreateDataStruct;
|
||||
|
||||
public:
|
||||
char mString[128];
|
||||
|
|
|
@ -40,4 +40,5 @@
|
|||
|
||||
[scriptable, uuid(482e1890-1fe5-11d5-9cf8-0060b0fbd8ac)]
|
||||
interface nsISimplePlugin : nsISupports {
|
||||
void hasPlugletForMimeType(in string aMimeType, out boolean isSupported);
|
||||
};
|
||||
|
|
|
@ -121,3 +121,14 @@ void nsScriptablePeer::SetInstance(nsPluginInstance* plugin)
|
|||
// mPlugin->getVersion(aVersion);
|
||||
// return NS_OK;
|
||||
//}
|
||||
|
||||
NS_IMETHODIMP nsScriptablePeer::HasPlugletForMimeType(const char *aMimeType, PRBool *isSupported)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if (mPlugin) {
|
||||
rv = mPlugin->HasPlugletForMimeType(aMimeType, isSupported);
|
||||
}
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ PRLogModuleInfo* PlugletLog::log = NULL;
|
|||
int PlugletEngine::objectCount = 0;
|
||||
PlugletsDir * PlugletEngine::dir = NULL;
|
||||
PRInt32 PlugletEngine::lockCount = 0;
|
||||
PlugletEngine * PlugletEngine::engine = NULL;
|
||||
nsCOMPtr<nsIPluginManager> PlugletEngine::pluginManager;
|
||||
jobject PlugletEngine::plugletManager = NULL;
|
||||
|
||||
|
@ -62,7 +61,6 @@ PlugletEngine::PlugletEngine() {
|
|||
NS_INIT_ISUPPORTS();
|
||||
PlugletLog::log = PR_NewLogModule("pluglets");
|
||||
dir = new PlugletsDir();
|
||||
engine = this;
|
||||
objectCount++;
|
||||
}
|
||||
|
||||
|
@ -185,8 +183,13 @@ void PlugletEngine::StartJVM() {
|
|||
return;
|
||||
}
|
||||
char classpath[1024]="";
|
||||
char debug[256]="";
|
||||
char runjdwp[256]="";
|
||||
sprintf(debug, "-Xdebug");
|
||||
sprintf(runjdwp,
|
||||
"-Xrunjdwp:transport=dt_shmem,address=jdbconn,server=y,suspend=y");
|
||||
JavaVMInitArgs vm_args;
|
||||
JavaVMOption options[2];
|
||||
JavaVMOption options[4];
|
||||
char * classpathEnv = PR_GetEnv("CLASSPATH");
|
||||
if (classpathEnv != NULL) {
|
||||
sprintf(classpath, "-Djava.class.path=%s",classpathEnv);
|
||||
|
@ -194,11 +197,13 @@ void PlugletEngine::StartJVM() {
|
|||
("PlugletEngine::StartJVM about to create JVM classpath=%s\n",classpath));
|
||||
}
|
||||
options[0].optionString = classpath;
|
||||
options[1].optionString=""; //-Djava.compiler=NONE";
|
||||
vm_args.version = 0x00010002;
|
||||
options[1].optionString = debug;
|
||||
options[2].optionString = runjdwp;
|
||||
options[3].optionString=""; //-Djava.compiler=NONE";
|
||||
vm_args.version = JNI_VERSION_1_4;
|
||||
vm_args.options = options;
|
||||
vm_args.nOptions = 2;
|
||||
vm_args.ignoreUnrecognized = JNI_TRUE;
|
||||
vm_args.nOptions = 1; // EDBURNS: Change for debugging
|
||||
vm_args.ignoreUnrecognized = JNI_FALSE;
|
||||
/* Create the Java VM */
|
||||
res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
|
||||
printf("--bcJavaGlobal::StartJVM jvm started res %d\n",res);
|
||||
|
@ -276,15 +281,6 @@ NS_IMETHODIMP PlugletEngine::GetPlugletManager(void * *jobj)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP PlugletEngine::GetEngine(iPlugletEngine **outEngine)
|
||||
{
|
||||
if (nsnull == outEngine) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*outEngine = engine;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP PlugletEngine::IncObjectCount()
|
||||
{
|
||||
objectCount++;
|
||||
|
@ -317,14 +313,16 @@ static NS_METHOD PlugletEngineRegistration(nsIComponentManager *aCompMgr,
|
|||
nsresult rv;
|
||||
nsCOMPtr<nsIServiceManager> servman =
|
||||
do_QueryInterface((nsISupports*)aCompMgr, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
nsCOMPtr<nsICategoryManager> catman;
|
||||
servman->GetServiceByContractID(NS_CATEGORYMANAGER_CONTRACTID,
|
||||
NS_GET_IID(nsICategoryManager),
|
||||
getter_AddRefs(catman));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
char* previous = nsnull;
|
||||
rv = catman->AddCategoryEntry("xpcom-startup",
|
||||
"PlugletEngine",
|
||||
|
@ -362,7 +360,7 @@ static NS_METHOD PlugletEngineUnregistration(nsIComponentManager *aCompMgr,
|
|||
|
||||
NS_EXPORT
|
||||
nsresult
|
||||
iPlugletEngine::GetInstance(iPlugletEngine* *result)
|
||||
iPlugletEngine::GetInstance(void ** result)
|
||||
{
|
||||
nsIServiceManager *servman = nsnull;
|
||||
NS_GetServiceManager(&servman);
|
||||
|
@ -370,6 +368,9 @@ iPlugletEngine::GetInstance(iPlugletEngine* *result)
|
|||
rv = servman->GetServiceByContractID(PLUGLETENGINE_ContractID,
|
||||
NS_GET_IID(iPlugletEngine),
|
||||
(void **) &result);
|
||||
|
||||
printf("debug: edburns: plugletEngine instance rv: %d\n", rv);
|
||||
printf("debug: edburns: plugletEngine instance result: %p\n", *result);
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("Pluglet::PlugletFactory: Cannot access iPlugletEngine service\n"));
|
||||
|
@ -386,8 +387,7 @@ PlugletEngine *PlugletEngine::_NewInstance()
|
|||
return result;
|
||||
}
|
||||
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(PlugletEngine,
|
||||
PlugletEngine::_NewInstance)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(PlugletEngine)
|
||||
|
||||
static const nsModuleComponentInfo components[] =
|
||||
{
|
||||
|
|
|
@ -48,7 +48,6 @@ class PlugletEngine : public nsIObserver, public iPlugletEngine, public nsIPlugi
|
|||
static int objectCount;
|
||||
static PRInt32 lockCount;
|
||||
static PlugletsDir *dir;
|
||||
static PlugletEngine * engine;
|
||||
static nsCOMPtr<nsIPluginManager> pluginManager;
|
||||
static jobject plugletManager;
|
||||
#ifndef OJI_DISABLE
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "plstr.h"
|
||||
#include "PlugletLog.h"
|
||||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
jmethodID PlugletFactory::createPlugletMID = NULL;
|
||||
jmethodID PlugletFactory::initializeMID = NULL;
|
||||
jmethodID PlugletFactory::shutdownMID = NULL;
|
||||
|
@ -40,7 +42,8 @@ nsresult PlugletFactory::CreatePluginInstance(const char* aPluginMIMEType, void
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
JNIEnv *env = nsnull;
|
||||
nsresult rv;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
rv = plugletEngine->GetJNIEnv(&env);
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -159,18 +162,15 @@ PlugletFactory::PlugletFactory(const char *mimeDescription, const char *path) :
|
|||
this->mimeDescription = new char[strlen(mimeDescription)+1];
|
||||
strcpy(this->mimeDescription,mimeDescription);
|
||||
|
||||
nsIServiceManager *servman = nsnull;
|
||||
NS_GetServiceManager(&servman);
|
||||
nsresult rv;
|
||||
rv = servman->GetServiceByContractID(PLUGLETENGINE_ContractID,
|
||||
NS_GET_IID(iPlugletEngine),
|
||||
getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
plugletEngine = do_GetService(PLUGLETENGINE_ContractID, &rv);
|
||||
printf("debug: edburns: PlugletFactory ctor: rv: %d\n", rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("Pluglet::PlugletFactory: Cannot access iPlugletEngine service\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
printf("debug: edburns: PlugletFactory ctor: this: %p\n", this);
|
||||
}
|
||||
|
||||
PlugletFactory::~PlugletFactory(void) {
|
||||
|
|
|
@ -22,12 +22,15 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "iPlugletEngine.h"
|
||||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
jclass PlugletInputStream::clazz = NULL;
|
||||
jmethodID PlugletInputStream::initMID = NULL;
|
||||
|
||||
void PlugletInputStream::Initialize(void) {
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -55,8 +58,9 @@ void PlugletInputStream::Initialize(void) {
|
|||
|
||||
void PlugletInputStream::Destroy(void) {
|
||||
//nb who gonna cal it?
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -73,8 +77,9 @@ void PlugletInputStream::Destroy(void) {
|
|||
|
||||
jobject PlugletInputStream::GetJObject(const nsIInputStream *stream) {
|
||||
jobject res = nsnull;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
#include "iPlugletEngine.h"
|
||||
#include "PlugletLoader.h"
|
||||
#include "PlugletLog.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCOMPtr.h"-
|
||||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
jclass PlugletLoader::clazz = nsnull;
|
||||
jmethodID PlugletLoader::getMIMEDescriptionMID = nsnull;
|
||||
|
@ -45,12 +47,17 @@ static char *ToString(jobject obj,JNIEnv *env) {
|
|||
return res;
|
||||
}
|
||||
|
||||
void PlugletLoader::Initialize(void) {
|
||||
NS_EXPORT void PlugletLoader::Initialize(void) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletLoader::Initialize\n"));
|
||||
//nb errors handling
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);
|
||||
|
||||
printf("debug: edburns: plugletEngine: %p", plugletEngine.get());
|
||||
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -88,8 +95,9 @@ void PlugletLoader::Initialize(void) {
|
|||
void PlugletLoader::Destroy(void) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletLoader::destroy\n"));
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -112,8 +120,9 @@ char * PlugletLoader::GetMIMEDescription(const char * path) {
|
|||
return nsnull;
|
||||
}
|
||||
}
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -134,6 +143,8 @@ char * PlugletLoader::GetMIMEDescription(const char * path) {
|
|||
}
|
||||
|
||||
const char* str = env->GetStringUTFChars(mimeDescription,nsnull);
|
||||
|
||||
printf("debug: edburns: mime description: %s\n", str);
|
||||
char *res = nsnull;
|
||||
if(str) {
|
||||
res = new char[strlen(str)+1];
|
||||
|
@ -153,8 +164,9 @@ jobject PlugletLoader::GetPluglet(const char * path) {
|
|||
return nsnull;
|
||||
}
|
||||
}
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsnull;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class PlugletLoader {
|
|||
public:
|
||||
static char * GetMIMEDescription(const char * path);
|
||||
static jobject GetPluglet(const char * path);
|
||||
static void Initialize(void);
|
||||
static NS_EXPORT void Initialize(void);
|
||||
static void Destroy(void);
|
||||
private:
|
||||
static jclass clazz;
|
||||
|
|
|
@ -22,12 +22,15 @@
|
|||
#include "iPlugletEngine.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
jclass PlugletManager::clazz = NULL;
|
||||
jmethodID PlugletManager::initMID = NULL;
|
||||
|
||||
void PlugletManager::Initialize(void) {
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -55,8 +58,9 @@ void PlugletManager::Initialize(void) {
|
|||
|
||||
void PlugletManager::Destroy(void) {
|
||||
//nb who gonna cal it?
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -73,8 +77,9 @@ void PlugletManager::Destroy(void) {
|
|||
|
||||
jobject PlugletManager::GetJObject(const nsIPluginManager *stream) {
|
||||
jobject res = NULL;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsnull;
|
||||
}
|
||||
|
|
|
@ -23,12 +23,15 @@
|
|||
#include "iPlugletEngine.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
jclass PlugletPeer::clazz = nsnull;
|
||||
jmethodID PlugletPeer::initMID = nsnull;
|
||||
|
||||
void PlugletPeer::Initialize(void) {
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -56,8 +59,9 @@ void PlugletPeer::Initialize(void) {
|
|||
|
||||
void PlugletPeer::Destroy(void) {
|
||||
//nb who gonna cal it?
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -73,8 +77,9 @@ void PlugletPeer::Destroy(void) {
|
|||
|
||||
jobject PlugletPeer::GetJObject(const nsIPluginInstancePeer *peer) {
|
||||
jobject res = nsnull;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -22,12 +22,15 @@
|
|||
#include "iPlugletEngine.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
jclass PlugletStreamInfo::clazz = nsnull;
|
||||
jmethodID PlugletStreamInfo::initMID = nsnull;
|
||||
|
||||
void PlugletStreamInfo::Initialize(void) {
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -53,8 +56,9 @@ void PlugletStreamInfo::Initialize(void) {
|
|||
|
||||
void PlugletStreamInfo::Destroy(void) {
|
||||
//nb who gonna call it?
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -70,8 +74,9 @@ void PlugletStreamInfo::Destroy(void) {
|
|||
|
||||
jobject PlugletStreamInfo::GetJObject(const nsIPluginStreamInfo *streamInfo) {
|
||||
jobject res = nsnull;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsnull;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "PlugletInputStream.h"
|
||||
#include "PlugletLog.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
jmethodID PlugletStreamListener::onStartBindingMID = NULL;
|
||||
jmethodID PlugletStreamListener::onDataAvailableMID = NULL;
|
||||
|
@ -34,8 +35,9 @@ jmethodID PlugletStreamListener::getStreamTypeMID = NULL;
|
|||
void PlugletStreamListener::Initialize(void) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletStreamListener::Initialize\n"));
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -53,8 +55,9 @@ void PlugletStreamListener::Initialize(void) {
|
|||
}
|
||||
|
||||
PlugletStreamListener::PlugletStreamListener(jobject object) {
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -71,8 +74,9 @@ PlugletStreamListener::PlugletStreamListener(jobject object) {
|
|||
}
|
||||
|
||||
PlugletStreamListener::~PlugletStreamListener(void) {
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -88,8 +92,9 @@ PlugletStreamListener::~PlugletStreamListener(void) {
|
|||
NS_METHOD PlugletStreamListener::OnStartBinding(nsIPluginStreamInfo* pluginInfo) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletStreamListener::OnStartBinding\n"));
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -109,8 +114,9 @@ NS_METHOD PlugletStreamListener::OnStartBinding(nsIPluginStreamInfo* pluginInfo
|
|||
NS_METHOD PlugletStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo, nsIInputStream* input, PRUint32 length) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletStreamListener::OnDataAvailable\n"));
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -132,8 +138,9 @@ NS_METHOD PlugletStreamListener::OnDataAvailable(nsIPluginStreamInfo* pluginInfo
|
|||
NS_METHOD PlugletStreamListener::OnFileAvailable(nsIPluginStreamInfo* pluginInfo, const char* fileName) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletStreamListener::OnFileAvailable\n"));
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -155,8 +162,9 @@ NS_METHOD PlugletStreamListener::OnFileAvailable(nsIPluginStreamInfo* pluginInfo
|
|||
NS_METHOD PlugletStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo, nsresult status) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletStreamListener::OnStopBinding\n"));
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -176,8 +184,9 @@ NS_METHOD PlugletStreamListener::OnStopBinding(nsIPluginStreamInfo* pluginInfo,
|
|||
NS_METHOD PlugletStreamListener::GetStreamType(nsPluginStreamType *result) {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletStreamListener::GetStreamType\n"));
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "iPlugletEngine.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
jclass PlugletViewWindows::clazz = NULL;
|
||||
jmethodID PlugletViewWindows::initMID = NULL;
|
||||
|
@ -33,8 +34,9 @@ PlugletViewWindows::PlugletViewWindows() {
|
|||
isCreated = FALSE;
|
||||
}
|
||||
void PlugletViewWindows::Initialize() {
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -79,8 +81,9 @@ PRBool PlugletViewWindows::SetWindow(nsPluginWindow* window) {
|
|||
return PR_FALSE;
|
||||
}
|
||||
}
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
|
|
@ -25,91 +25,112 @@
|
|||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIDirectoryService.h"
|
||||
|
||||
PlugletsDir::PlugletsDir(void) {
|
||||
list = NULL;
|
||||
//nb ???
|
||||
static PRIntn DeleteEntryEnumerator(PLHashEntry *he, PRIntn i, void *arg)
|
||||
{
|
||||
PLHashTable *hash = (PLHashTable *) arg;
|
||||
PL_HashTableRemove(hash, he->key);
|
||||
|
||||
void *key = (void *) he->key;
|
||||
nsMemory::Free(key);
|
||||
|
||||
PlugletFactory *toDelete = (PlugletFactory *) he->value;
|
||||
delete toDelete;
|
||||
return 0;
|
||||
}
|
||||
|
||||
PlugletsDir::PlugletsDir(void) : mMimeTypeToPlugletFacoryHash(nsnull) {
|
||||
}
|
||||
|
||||
PlugletsDir::~PlugletsDir(void) {
|
||||
if (list) {
|
||||
for (ListIterator *iter = list->GetIterator();iter->Get();delete iter->Get(),iter->Next())
|
||||
;
|
||||
delete list;
|
||||
if (mMimeTypeToPlugletFacoryHash) {
|
||||
PL_HashTableEnumerateEntries(mMimeTypeToPlugletFacoryHash,
|
||||
DeleteEntryEnumerator,
|
||||
mMimeTypeToPlugletFacoryHash);
|
||||
PL_HashTableDestroy(mMimeTypeToPlugletFacoryHash);
|
||||
mMimeTypeToPlugletFacoryHash = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
void PlugletsDir::LoadPluglets() {
|
||||
nsresult PlugletsDir::LoadPluglets() {
|
||||
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
||||
("PlugletsDir::LoadPluglets\n"));
|
||||
if (!list) {
|
||||
list = new List();
|
||||
const char *mimeType = nsnull;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if (!mMimeTypeToPlugletFacoryHash) {
|
||||
mMimeTypeToPlugletFacoryHash =
|
||||
PL_NewHashTable(20, PL_HashString,
|
||||
PL_CompareStrings,
|
||||
PL_CompareValues,
|
||||
nsnull, nsnull);
|
||||
char * path = PR_GetEnv("PLUGLET");
|
||||
if (!path) {
|
||||
nsCOMPtr<nsIFile> sysDir;
|
||||
nsresult rv = NS_GetSpecialDirectory(NS_OS_CURRENT_PROCESS_DIR,
|
||||
getter_AddRefs(sysDir));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = sysDir->AppendNative(NS_LITERAL_CSTRING("plugins"));
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsXPIDLCString pluginsDir;
|
||||
rv = sysDir->GetNativePath(pluginsDir);
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
path = PL_strdup(pluginsDir.get());
|
||||
}
|
||||
if (!path) {
|
||||
return;
|
||||
return rv;
|
||||
}
|
||||
PlugletFactory *plugletFactory;
|
||||
nsFileSpec dir(path);
|
||||
for (nsDirectoryIterator iter(dir,PR_TRUE); iter.Exists(); iter++) {
|
||||
const nsFileSpec& file = iter;
|
||||
const char* name = file.GetCString();
|
||||
printf("debug: edburns: PlugletsDir::LoadPluglets: name: %s\n", name);
|
||||
int length;
|
||||
if((length = strlen(name)) <= 4 // if it's shorter than ".jar"
|
||||
|| strcmp(name+length - 4,".jar") ) {
|
||||
continue;
|
||||
}
|
||||
if ( (plugletFactory = PlugletFactory::Load(name)) ) {
|
||||
list->Add(plugletFactory);
|
||||
mimeType = nsnull;
|
||||
rv = plugletFactory->GetMIMEDescription(&mimeType);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
PLHashEntry *entry =
|
||||
PL_HashTableAdd(mMimeTypeToPlugletFacoryHash,
|
||||
(const void *) PL_strdup(mimeType),
|
||||
plugletFactory);
|
||||
rv = (nsnull != entry) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult PlugletsDir::GetPlugletFactory(const char * mimeType, PlugletFactory **plugletFactory) {
|
||||
if(!plugletFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*plugletFactory = NULL;
|
||||
*plugletFactory = nsnull;
|
||||
PlugletFactory *cur = nsnull;
|
||||
nsresult res = NS_ERROR_FAILURE;
|
||||
if(!list) {
|
||||
LoadPluglets();
|
||||
if(!mMimeTypeToPlugletFacoryHash) {
|
||||
res = LoadPluglets();
|
||||
}
|
||||
for (ListIterator *iter = list->GetIterator();iter->Get();iter->Next()) {
|
||||
if(((PlugletFactory*)(iter->Get()))->Compare(mimeType)) {
|
||||
*plugletFactory = (PlugletFactory*)iter->Get();
|
||||
res = NS_OK;
|
||||
break;
|
||||
}
|
||||
if (NS_SUCCEEDED(res) && mMimeTypeToPlugletFacoryHash) {
|
||||
*plugletFactory = (PlugletFactory *)
|
||||
PL_HashTableLookup(mMimeTypeToPlugletFacoryHash,
|
||||
(const void *)mimeType);
|
||||
printf("debug: edburns: %p\n", *plugletFactory);
|
||||
res = (nsnull != *plugletFactory) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -21,17 +21,17 @@
|
|||
#ifndef __PlugletsDir_h__
|
||||
#define __PlugletsDir_h__
|
||||
#include "PlugletFactory.h"
|
||||
#include "List.h"
|
||||
#include "plhash.h"
|
||||
|
||||
class PlugletsDir {
|
||||
friend class PlugletsDirIterator;
|
||||
public:
|
||||
PlugletsDir(void);
|
||||
~PlugletsDir(void);
|
||||
void LoadPluglets();
|
||||
nsresult LoadPluglets();
|
||||
nsresult GetPlugletFactory(const char * mimeType,PlugletFactory **plugletFactory);
|
||||
private:
|
||||
List * list;
|
||||
PLHashTable *mMimeTypeToPlugletFacoryHash;
|
||||
};
|
||||
#endif /* __PlugletsDir_h__ */
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "Registry.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
jclass Registry::clazz = NULL;
|
||||
jmethodID Registry::setPeerMID = NULL;
|
||||
jmethodID Registry::removeMID = NULL;
|
||||
|
@ -34,8 +36,9 @@ void Registry::SetPeer(jobject key, jlong peer) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -59,8 +62,9 @@ void Registry::Remove(jobject key) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
@ -78,8 +82,9 @@ void Registry::Remove(jobject key) {
|
|||
}
|
||||
|
||||
void Registry::Initialize() {
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine;
|
||||
nsresult rv = iPlugletEngine::GetInstance(getter_AddRefs(plugletEngine));
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<iPlugletEngine> plugletEngine =
|
||||
do_GetService(PLUGLETENGINE_ContractID, &rv);;
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -31,13 +31,12 @@ interface iPlugletEngine : nsISupports
|
|||
|
||||
[noscript] void getJNIEnv(out JNIEnv outEnv);
|
||||
[noscript] void getPlugletManager(out voidPtr jobj);
|
||||
void getEngine(out iPlugletEngine engine);
|
||||
void incObjectCount();
|
||||
void decObjectCount();
|
||||
readonly attribute boolean unloadable;
|
||||
%{C++
|
||||
|
||||
static NS_EXPORT nsresult GetInstance(iPlugletEngine* *result);
|
||||
static NS_EXPORT nsresult GetInstance(void **result);
|
||||
|
||||
%}
|
||||
};
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
|
||||
* Ed Burns >edburns@acm.org<
|
||||
|
||||
|
||||
-->
|
||||
|
||||
<project name="SimpleTestPluglet" default="main" basedir=".">
|
||||
|
||||
<property name="Name" value="pluglets"/>
|
||||
<property name="name" value="pluglets"/>
|
||||
<property name="version" value="20060619"/>
|
||||
|
||||
<!-- ************ Per user local properties ******************************* -->
|
||||
|
||||
<property file="${user.home}/build.properties"/> <!-- User local -->
|
||||
<property file="build.properties"/> <!-- Component local -->
|
||||
<property file="../../build.properties"/> <!-- java-supplement local -->
|
||||
<property environment="myenv" />
|
||||
|
||||
<!-- ************ Compiler Defaults *************************************** -->
|
||||
|
||||
<!-- Should Java compilations set the 'debug' compiler option? -->
|
||||
<property name="compile.debug" value="true"/>
|
||||
<property name="compile.source" value="1.3"/>
|
||||
|
||||
<!-- Should Java compilations set the 'deprecation' compiler option? -->
|
||||
<property name="compile.deprecation" value="false"/>
|
||||
|
||||
<!-- Should Java compilations set the 'optimize' compiler option? -->
|
||||
<property name="compile.optimize" value="false"/>
|
||||
|
||||
<!-- ************ Where are we building into? ***************************** -->
|
||||
|
||||
<!-- The base directory for component sources -->
|
||||
<property name="source.home" value="${basedir}/classes"/>
|
||||
|
||||
<!-- Construct compile classpath -->
|
||||
<path id="compile.classpath">
|
||||
<pathelement location="${build.home}"/>
|
||||
</path>
|
||||
|
||||
<target name="prepare">
|
||||
|
||||
<condition property="PATH_SEP" value=";">
|
||||
<and>
|
||||
<os family="windows" />
|
||||
</and>
|
||||
</condition>
|
||||
|
||||
<condition property="PATH_SEP" value=":">
|
||||
<and>
|
||||
<os family="unix" />
|
||||
</and>
|
||||
</condition>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="main"
|
||||
depends="prepare,compile.examples"/>
|
||||
|
||||
<target name="clean" >
|
||||
<delete dir="${basedir}/build" />
|
||||
</target>
|
||||
|
||||
<target name="compile.examples">
|
||||
|
||||
<mkdir dir="build" />
|
||||
|
||||
<javac destdir="${basedir}/build"
|
||||
debug="${compile.debug}"
|
||||
source="${compile.source}"
|
||||
deprecation="${compile.deprecation}"
|
||||
optimize="${compile.optimize}" srcdir="${basedir}">
|
||||
<classpath refid="compile.classpath"/>
|
||||
<include name="test.java" />
|
||||
</javac>
|
||||
|
||||
<jar jarfile="${basedir}/build/test.jar">
|
||||
<manifest>
|
||||
<attribute name="MIMEDescription" value="video/avi"/>
|
||||
<attribute name="Pluglet-Class" value="test"/>
|
||||
</manifest>
|
||||
<fileset dir="${basedir}/build">
|
||||
<include name="*.class" />
|
||||
</fileset>
|
||||
</jar>
|
||||
|
||||
<copy todir="${myenv.MOZ_SRC}/mozilla/dist/bin/plugins"
|
||||
file="${basedir}/build/test.jar" />
|
||||
|
||||
</target>
|
||||
|
||||
</project>
|
Загрузка…
Ссылка в новой задаче