1999-09-08 04:21:03 +04:00
|
|
|
/*
|
1999-11-06 05:47:15 +03:00
|
|
|
* The contents of this file are subject to the Mozilla 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/MPL/
|
1999-09-08 04:21:03 +04:00
|
|
|
*
|
1999-11-06 05:47:15 +03:00
|
|
|
* 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.
|
1999-09-08 04:21:03 +04:00
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Sun Microsystems,
|
1999-11-06 05:47:15 +03:00
|
|
|
* Inc. Portions created by Sun are
|
|
|
|
* Copyright (C) 1999 Sun Microsystems, Inc. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1999-09-08 04:21:03 +04:00
|
|
|
*/
|
|
|
|
#include "nsIPluginManager.h"
|
|
|
|
#include "org_mozilla_pluglet_mozilla_PlugletManagerImpl.h"
|
2000-01-18 05:53:58 +03:00
|
|
|
#include "PlugletLog.h"
|
|
|
|
|
1999-09-12 03:47:47 +04:00
|
|
|
static jfieldID peerFID = NULL;
|
2000-01-18 05:53:58 +03:00
|
|
|
PRLogModuleInfo* PlugletLog::log = NULL;
|
|
|
|
|
|
|
|
|
1999-09-08 04:21:03 +04:00
|
|
|
/*
|
|
|
|
* Class: org_mozilla_pluglet_mozilla_PlugletManagerImpl
|
|
|
|
* Method: reloadPluglets
|
|
|
|
* Signature: (Z)V
|
|
|
|
*/
|
|
|
|
JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_reloadPluglets
|
1999-09-28 09:23:02 +04:00
|
|
|
(JNIEnv *env, jobject jthis, jboolean jparam) {
|
1999-09-12 03:47:47 +04:00
|
|
|
nsIPluginManager * manager = (nsIPluginManager*)env->GetLongField(jthis, peerFID);
|
2000-01-18 05:53:58 +03:00
|
|
|
if (!manager) {
|
|
|
|
PR_LOG(PlugletLog::log, PR_LOG_ERROR,
|
|
|
|
("PlugletManagerImpl.reloadPluglets: ERROR, manager = NULL"));
|
|
|
|
}
|
1999-09-28 09:23:02 +04:00
|
|
|
PRBool param = (jparam == JNI_TRUE) ? PR_TRUE : PR_FALSE;
|
2000-01-18 05:53:58 +03:00
|
|
|
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
|
|
|
("PlugletManagerImpl.reloadPluglets: param = %i\n", param));
|
1999-09-28 09:23:02 +04:00
|
|
|
manager->ReloadPlugins(param);
|
1999-09-08 04:21:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_mozilla_pluglet_mozilla_PlugletManagerImpl
|
|
|
|
* Method: userAgent
|
|
|
|
* Signature: ()Ljava/lang/String;
|
|
|
|
*/
|
|
|
|
JNIEXPORT jstring JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_userAgent
|
1999-09-12 03:47:47 +04:00
|
|
|
(JNIEnv *env, jobject jthis) {
|
|
|
|
nsIPluginManager * manager = (nsIPluginManager*)env->GetLongField(jthis, peerFID);
|
2000-01-18 05:53:58 +03:00
|
|
|
if (!manager) {
|
|
|
|
PR_LOG(PlugletLog::log, PR_LOG_ERROR,
|
|
|
|
("PlugletManagerImpl.userAgent: ERROR, manager = NULL"));
|
|
|
|
}
|
1999-09-28 09:23:02 +04:00
|
|
|
const char * res = NULL;
|
|
|
|
if (NS_FAILED(manager->UserAgent(&res))
|
|
|
|
|| !res) {
|
|
|
|
return NULL;
|
|
|
|
} else {
|
2000-01-18 05:53:58 +03:00
|
|
|
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
|
|
|
("PlugletManagerImpl.userAgent: result = %s\n", res));
|
1999-09-28 09:23:02 +04:00
|
|
|
return env->NewStringUTF(res);
|
|
|
|
}
|
1999-09-08 04:21:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_mozilla_pluglet_mozilla_PlugletManagerImpl
|
|
|
|
* Method: getURL
|
1999-11-09 13:28:46 +03:00
|
|
|
* Signature: (Lorg/mozilla/pluglet/Pluglet;Ljava/net/URL;Ljava/lang/String;Lorg/mozilla/pluglet/PlugletStreamListener;Ljava/lang/String;Ljava/net/URL;Z)V
|
1999-09-08 04:21:03 +04:00
|
|
|
*/
|
|
|
|
JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_getURL
|
1999-09-12 03:47:47 +04:00
|
|
|
(JNIEnv *env, jobject jthis, jobject, jobject, jstring, jobject, jstring, jobject, jboolean) {
|
|
|
|
nsIPluginManager * manager = (nsIPluginManager*)env->GetLongField(jthis, peerFID);
|
2000-01-18 05:53:58 +03:00
|
|
|
if (manager) {
|
|
|
|
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
|
|
|
("PlugletManagerImpl.getURL: manager = %s\n", manager));
|
|
|
|
}
|
1999-09-08 04:21:03 +04:00
|
|
|
//nb
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_mozilla_pluglet_mozilla_PlugletManagerImpl
|
|
|
|
* Method: postURL
|
1999-11-09 13:28:46 +03:00
|
|
|
* Signature: (Lorg/mozilla/pluglet/Pluglet;Ljava/net/URL;I[BZLjava/lang/String;Lorg/mozilla/pluglet/PlugletStreamListener;Ljava/lang/String;Ljava/net/URL;ZI[B)V
|
1999-09-08 04:21:03 +04:00
|
|
|
*/
|
|
|
|
JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_postURL
|
1999-09-12 03:47:47 +04:00
|
|
|
(JNIEnv *env, jobject jthis, jobject, jobject, jint, jbyteArray, jboolean, jstring, jobject, jstring, jobject, jboolean, jint, jbyteArray) {
|
|
|
|
nsIPluginManager * manager = (nsIPluginManager*)env->GetLongField(jthis, peerFID);
|
2000-01-18 05:53:58 +03:00
|
|
|
if (manager) {
|
|
|
|
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
|
|
|
("PlugletManagerImpl.postURL: manager = %s\n", manager));
|
|
|
|
}
|
1999-09-08 04:21:03 +04:00
|
|
|
//nb
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_mozilla_pluglet_mozilla_PlugletManagerImpl
|
|
|
|
* Method: nativeFinalize
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_nativeFinalize
|
1999-09-12 03:47:47 +04:00
|
|
|
(JNIEnv *env, jobject jthis) {
|
|
|
|
nsIPluginManager * manager = (nsIPluginManager*)env->GetLongField(jthis, peerFID);
|
|
|
|
if(manager) {
|
2000-01-18 05:53:58 +03:00
|
|
|
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
|
|
|
("PlugletManagerImpl.nativeFinalize: manager = %s\n", manager));
|
1999-09-12 03:47:47 +04:00
|
|
|
NS_RELEASE(manager);
|
|
|
|
}
|
1999-09-08 04:21:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Class: org_mozilla_pluglet_mozilla_PlugletManagerImpl
|
|
|
|
* Method: nativeInitialize
|
|
|
|
* Signature: ()V
|
|
|
|
*/
|
|
|
|
JNIEXPORT void JNICALL Java_org_mozilla_pluglet_mozilla_PlugletManagerImpl_nativeInitialize
|
1999-09-12 03:47:47 +04:00
|
|
|
(JNIEnv *env, jobject jthis) {
|
2000-01-18 05:53:58 +03:00
|
|
|
PlugletLog::log = PR_NewLogModule("pluglets");
|
1999-09-12 03:47:47 +04:00
|
|
|
if(!peerFID) {
|
|
|
|
peerFID = env->GetFieldID(env->GetObjectClass(jthis),"peer","J");
|
|
|
|
if (!peerFID) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nsIPluginManager * manager = (nsIPluginManager*)env->GetLongField(jthis, peerFID);
|
|
|
|
if (manager) {
|
2000-01-18 05:53:58 +03:00
|
|
|
PR_LOG(PlugletLog::log, PR_LOG_DEBUG,
|
|
|
|
("PlugletManagerImpl.nativeInitialize: manager = %p\n", manager));
|
1999-09-12 03:47:47 +04:00
|
|
|
manager->AddRef();
|
|
|
|
}
|
1999-09-08 04:21:03 +04:00
|
|
|
}
|
|
|
|
|
1999-09-28 09:23:02 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|