summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/jni')
-rw-r--r--WebKit/android/jni/JavaBridge.cpp53
-rw-r--r--WebKit/android/jni/JavaSharedClient.cpp11
-rw-r--r--WebKit/android/jni/JavaSharedClient.h6
-rw-r--r--WebKit/android/jni/WebSettings.cpp58
-rw-r--r--WebKit/android/jni/WebViewCore.cpp15
5 files changed, 66 insertions, 77 deletions
diff --git a/WebKit/android/jni/JavaBridge.cpp b/WebKit/android/jni/JavaBridge.cpp
index a713f17..6cb2167 100644
--- a/WebKit/android/jni/JavaBridge.cpp
+++ b/WebKit/android/jni/JavaBridge.cpp
@@ -33,6 +33,9 @@
#include "JavaSharedClient.h"
#include "KURL.h"
#include "NetworkStateNotifier.h"
+#include "Page.h"
+#include "PluginClient.h"
+#include "PluginDatabase.h"
#include "Timer.h"
#include "TimerClient.h"
#include "jni_utility.h"
@@ -55,7 +58,7 @@ static jfieldID gJavaBridge_ObjectID;
// ----------------------------------------------------------------------------
-class JavaBridge : public TimerClient, public CookieClient
+class JavaBridge : public TimerClient, public CookieClient, public PluginClient
{
public:
JavaBridge(JNIEnv* env, jobject obj);
@@ -71,6 +74,8 @@ public:
virtual WebCore::String cookies(WebCore::KURL const& url);
virtual bool cookiesEnabled();
+ virtual WTF::Vector<WebCore::String> getPluginDirectories();
+
////////////////////////////////////////////
virtual void setSharedTimerCallback(void (*f)());
@@ -87,6 +92,7 @@ public:
static void SetNetworkOnLine(JNIEnv* env, jobject obj, jboolean online);
static void SetDeferringTimers(JNIEnv* env, jobject obj, jboolean defer);
static void ServiceFuncPtrQueue(JNIEnv*);
+ static void UpdatePluginDirectories(JNIEnv* env, jobject obj, jobjectArray array, jboolean reload);
private:
jobject mJavaObject;
@@ -95,6 +101,7 @@ private:
jmethodID mSetCookies;
jmethodID mCookies;
jmethodID mCookiesEnabled;
+ jmethodID mGetPluginDirectories;
jmethodID mSignalFuncPtrQueue;
};
@@ -110,6 +117,7 @@ JavaBridge::JavaBridge(JNIEnv* env, jobject obj)
mSetCookies = env->GetMethodID(clazz, "setCookies", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
mCookies = env->GetMethodID(clazz, "cookies", "(Ljava/lang/String;)Ljava/lang/String;");
mCookiesEnabled = env->GetMethodID(clazz, "cookiesEnabled", "()Z");
+ mGetPluginDirectories = env->GetMethodID(clazz, "getPluginDirectories", "()[Ljava/lang/String;");
mSignalFuncPtrQueue = env->GetMethodID(clazz, "signalServiceFuncPtrQueue", "()V");
LOG_ASSERT(mSetSharedTimer, "Could not find method setSharedTimer");
@@ -120,8 +128,9 @@ JavaBridge::JavaBridge(JNIEnv* env, jobject obj)
JavaSharedClient::SetTimerClient(this);
JavaSharedClient::SetCookieClient(this);
-}
-
+ JavaSharedClient::SetPluginClient(this);
+}
+
JavaBridge::~JavaBridge()
{
if (mJavaObject) {
@@ -192,6 +201,25 @@ JavaBridge::cookiesEnabled()
return (ret != 0);
}
+WTF::Vector<WebCore::String>
+JavaBridge::getPluginDirectories()
+{
+ WTF::Vector<WebCore::String> directories;
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject obj = getRealObject(env, mJavaObject);
+ jobjectArray array = (jobjectArray)
+ env->CallObjectMethod(obj.get(), mGetPluginDirectories);
+ int count = env->GetArrayLength(array);
+ for (int i = 0; i < count; i++) {
+ jstring dir = (jstring) env->GetObjectArrayElement(array, i);
+ directories.append(to_string(env, dir));
+ env->DeleteLocalRef(dir);
+ }
+ env->DeleteLocalRef(array);
+ checkException(env);
+ return directories;
+}
+
void
JavaBridge::setSharedTimerCallback(void (*f)())
{
@@ -260,6 +288,23 @@ void JavaBridge::ServiceFuncPtrQueue(JNIEnv*)
JavaSharedClient::ServiceFunctionPtrQueue();
}
+void JavaBridge::UpdatePluginDirectories(JNIEnv* env, jobject obj,
+ jobjectArray array, jboolean reload) {
+ WTF::Vector<WebCore::String> directories;
+ int count = env->GetArrayLength(array);
+ for (int i = 0; i < count; i++) {
+ jstring dir = (jstring) env->GetObjectArrayElement(array, i);
+ directories.append(to_string(env, dir));
+ env->DeleteLocalRef(dir);
+ }
+ checkException(env);
+ WebCore::PluginDatabase *pluginDatabase =
+ WebCore::PluginDatabase::installedPlugins();
+ pluginDatabase->setPluginDirectories(directories);
+ // refreshPlugins() should refresh both PluginDatabase and Page's PluginData
+ WebCore::Page::refreshPlugins(reload);
+}
+
// ----------------------------------------------------------------------------
/*
@@ -279,6 +324,8 @@ static JNINativeMethod gWebCoreJavaBridgeMethods[] = {
(void*) JavaBridge::SetNetworkOnLine },
{ "nativeServiceFuncPtrQueue", "()V",
(void*) JavaBridge::ServiceFuncPtrQueue },
+ { "nativeUpdatePluginDirectories", "([Ljava/lang/String;Z)V",
+ (void*) JavaBridge::UpdatePluginDirectories }
};
int register_javabridge(JNIEnv* env)
diff --git a/WebKit/android/jni/JavaSharedClient.cpp b/WebKit/android/jni/JavaSharedClient.cpp
index fcccd85..3ddf726 100644
--- a/WebKit/android/jni/JavaSharedClient.cpp
+++ b/WebKit/android/jni/JavaSharedClient.cpp
@@ -40,6 +40,11 @@ namespace android {
return gCookieClient;
}
+ PluginClient* JavaSharedClient::GetPluginClient()
+ {
+ return gPluginClient;
+ }
+
void JavaSharedClient::SetTimerClient(TimerClient* client)
{
gTimerClient = client;
@@ -50,8 +55,14 @@ namespace android {
gCookieClient = client;
}
+ void JavaSharedClient::SetPluginClient(PluginClient* client)
+ {
+ gPluginClient = client;
+ }
+
TimerClient* JavaSharedClient::gTimerClient = NULL;
CookieClient* JavaSharedClient::gCookieClient = NULL;
+ PluginClient* JavaSharedClient::gPluginClient = NULL;
///////////////////////////////////////////////////////////////////////////
diff --git a/WebKit/android/jni/JavaSharedClient.h b/WebKit/android/jni/JavaSharedClient.h
index 05788e1..69c05ce 100644
--- a/WebKit/android/jni/JavaSharedClient.h
+++ b/WebKit/android/jni/JavaSharedClient.h
@@ -30,24 +30,28 @@ namespace android {
class TimerClient;
class CookieClient;
+ class PluginClient;
class JavaSharedClient
{
public:
static TimerClient* GetTimerClient();
static CookieClient* GetCookieClient();
+ static PluginClient* GetPluginClient();
static void SetTimerClient(TimerClient* client);
static void SetCookieClient(CookieClient* client);
+ static void SetPluginClient(PluginClient* client);
// can be called from any thread, to be executed in webkit thread
static void EnqueueFunctionPtr(void (*proc)(void*), void* payload);
// only call this from webkit thread
static void ServiceFunctionPtrQueue();
-
+
private:
static TimerClient* gTimerClient;
static CookieClient* gCookieClient;
+ static PluginClient* gPluginClient;
};
}
#endif
diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp
index 7741074..110cde0 100644
--- a/WebKit/android/jni/WebSettings.cpp
+++ b/WebKit/android/jni/WebSettings.cpp
@@ -41,10 +41,6 @@
#include "DocLoader.h"
#include "Page.h"
#include "RenderTable.h"
-#ifdef ANDROID_PLUGINS
-#include "PlatformString.h"
-#include "PluginDatabase.h"
-#endif
#include "Settings.h"
#include "WebCoreFrameBridge.h"
#include "WebCoreJni.h"
@@ -52,11 +48,6 @@
#include <JNIHelp.h>
#include <utils/misc.h>
-namespace WebCore {
-// Defined in FileSystemAndroid.cpp
-extern String sPluginPath;
-}
-
namespace android {
struct FieldIds {
@@ -91,9 +82,6 @@ struct FieldIds {
#endif
mJavaScriptEnabled = env->GetFieldID(clazz, "mJavaScriptEnabled", "Z");
mPluginsEnabled = env->GetFieldID(clazz, "mPluginsEnabled", "Z");
-#ifdef ANDROID_PLUGINS
- mPluginsPath = env->GetFieldID(clazz, "mPluginsPath", "Ljava/lang/String;");
-#endif
#if ENABLE(DATABASE)
mDatabaseEnabled = env->GetFieldID(clazz, "mDatabaseEnabled", "Z");
mDatabasePath = env->GetFieldID(clazz, "mDatabasePath", "Ljava/lang/String;");
@@ -129,9 +117,6 @@ struct FieldIds {
#endif
LOG_ASSERT(mJavaScriptEnabled, "Could not find field mJavaScriptEnabled");
LOG_ASSERT(mPluginsEnabled, "Could not find field mPluginsEnabled");
-#ifdef ANDROID_PLUGINS
- LOG_ASSERT(mPluginsPath, "Could not find field mPluginsPath");
-#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
LOG_ASSERT(mAppCacheEnabled, "Could not find field mAppCacheEnabled");
LOG_ASSERT(mAppCachePath, "Could not find field mAppCachePath");
@@ -173,9 +158,6 @@ struct FieldIds {
#endif
jfieldID mJavaScriptEnabled;
jfieldID mPluginsEnabled;
-#ifdef ANDROID_PLUGINS
- jfieldID mPluginsPath;
-#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
jfieldID mAppCacheEnabled;
jfieldID mAppCachePath;
@@ -299,46 +281,6 @@ public:
flag = env->GetBooleanField(obj, gFieldIds->mPluginsEnabled);
s->setPluginsEnabled(flag);
-#ifdef ANDROID_PLUGINS
- ::WebCore::PluginDatabase *pluginDatabase =
- ::WebCore::PluginDatabase::installedPlugins();
- str = (jstring)env->GetObjectField(obj, gFieldIds->mPluginsPath);
- if (str) {
- WebCore::String pluginsPath = to_string(env, str);
- // When a new browser Tab is created, the corresponding
- // Java WebViewCore object will sync (with the native
- // side) its associated WebSettings at initialization
- // time. However, at that point, the WebSettings object's
- // mPluginsPaths member is set to the empty string. The
- // real plugin path will be set later by the tab and the
- // WebSettings will be synced again.
- //
- // There is no point in instructing WebCore's
- // PluginDatabase instance to set the plugin path to the
- // empty string. Furthermore, if the PluginDatabase
- // instance is already initialized, setting the path to
- // the empty string will cause the PluginDatabase to
- // forget about the plugin files it has already
- // inspected. When the path is subsequently set to the
- // correct value, the PluginDatabase will attempt to load
- // and initialize plugins that are already loaded and
- // initialized.
- if (pluginsPath.length()) {
- s->setPluginsPath(pluginsPath);
- // Set the plugin directories to this single entry.
- WTF::Vector< ::WebCore::String > paths(1);
- paths[0] = pluginsPath;
- pluginDatabase->setPluginDirectories(paths);
- // Set the home directory for plugin temporary files
- WebCore::sPluginPath = paths[0];
- // Reload plugins. We call Page::refreshPlugins() instead
- // of pluginDatabase->refresh(), as we need to ensure that
- // the list of mimetypes exposed by the browser are also
- // updated.
- WebCore::Page::refreshPlugins(false);
- }
- }
-#endif
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
flag = env->GetBooleanField(obj, gFieldIds->mAppCacheEnabled);
s->setOfflineWebApplicationCacheEnabled(flag);
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 1810859..a59b967 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -68,7 +68,6 @@
#include "Page.h"
#include "PlatformKeyboardEvent.h"
#include "PlatformString.h"
-#include "PluginInfoStore.h"
#include "PluginWidgetAndroid.h"
#include "Position.h"
#include "ProgressTracker.h"
@@ -2561,18 +2560,6 @@ static void SetDatabaseQuota(JNIEnv* env, jobject obj, jlong quota) {
#endif
}
-static void RefreshPlugins(JNIEnv *env,
- jobject obj,
- jboolean reloadOpenPages)
-{
-#ifdef ANDROID_INSTRUMENT
- TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter);
-#endif
- // Refresh the list of plugins, optionally reloading all open
- // pages.
- WebCore::refreshPlugins(reloadOpenPages);
-}
-
static void RegisterURLSchemeAsLocal(JNIEnv* env, jobject obj, jstring scheme) {
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter);
@@ -2686,8 +2673,6 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = {
(void*) SetBackgroundColor },
{ "nativeGetSelection", "(Landroid/graphics/Region;)Ljava/lang/String;",
(void*) GetSelection },
- { "nativeRefreshPlugins", "(Z)V",
- (void*) RefreshPlugins },
{ "nativeRegisterURLSchemeAsLocal", "(Ljava/lang/String;)V",
(void*) RegisterURLSchemeAsLocal },
{ "nativeDumpDomTree", "(Z)V",