summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni/WebSettings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/jni/WebSettings.cpp')
-rw-r--r--WebKit/android/jni/WebSettings.cpp115
1 files changed, 57 insertions, 58 deletions
diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp
index 407544a..7d2b12d 100644
--- a/WebKit/android/jni/WebSettings.cpp
+++ b/WebKit/android/jni/WebSettings.cpp
@@ -28,17 +28,15 @@
#include <config.h>
#include <wtf/Platform.h>
+#include "ApplicationCacheStorage.h"
+#include "DatabaseTracker.h"
+#include "DocLoader.h"
#include "Document.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameView.h"
-#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"
@@ -46,11 +44,6 @@
#include <JNIHelp.h>
#include <utils/misc.h>
-namespace WebCore {
-// Defined in FileSystemAndroid.cpp
-extern String sPluginPath;
-}
-
namespace android {
struct FieldIds {
@@ -85,8 +78,20 @@ 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;");
+#if ENABLE(DATABASE)
+ mDatabaseEnabled = env->GetFieldID(clazz, "mDatabaseEnabled", "Z");
+#endif
+#if ENABLE(DOM_STORAGE)
+ mDomStorageEnabled = env->GetFieldID(clazz, "mDomStorageEnabled", "Z");
+#endif
+#if ENABLE(DATABASE) || ENABLE(DOM_STORAGE)
+ // The databases saved to disk for both the SQL and DOM Storage APIs are stored
+ // in the same base directory.
+ mDatabasePath = env->GetFieldID(clazz, "mDatabasePath", "Ljava/lang/String;");
+#endif
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ mAppCacheEnabled = env->GetFieldID(clazz, "mAppCacheEnabled", "Z");
+ mAppCachePath = env->GetFieldID(clazz, "mAppCachePath", "Ljava/lang/String;");
#endif
mJavaScriptCanOpenWindowsAutomatically = env->GetFieldID(clazz,
"mJavaScriptCanOpenWindowsAutomatically", "Z");
@@ -112,11 +117,12 @@ struct FieldIds {
LOG_ASSERT(mLoadsImagesAutomatically, "Could not find field mLoadsImagesAutomatically");
#ifdef ANDROID_BLOCK_NETWORK_IMAGE
LOG_ASSERT(mBlockNetworkImage, "Could not find field mBlockNetworkImage");
-#endif
+#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");
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ LOG_ASSERT(mAppCacheEnabled, "Could not find field mAppCacheEnabled");
+ LOG_ASSERT(mAppCachePath, "Could not find field mAppCachePath");
#endif
LOG_ASSERT(mJavaScriptCanOpenWindowsAutomatically,
"Could not find field mJavaScriptCanOpenWindowsAutomatically");
@@ -155,18 +161,28 @@ struct FieldIds {
#endif
jfieldID mJavaScriptEnabled;
jfieldID mPluginsEnabled;
-#ifdef ANDROID_PLUGINS
- jfieldID mPluginsPath;
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ jfieldID mAppCacheEnabled;
+ jfieldID mAppCachePath;
#endif
jfieldID mJavaScriptCanOpenWindowsAutomatically;
jfieldID mUseWideViewport;
jfieldID mSupportMultipleWindows;
jfieldID mShrinksStandaloneImagesToFit;
jfieldID mUseDoubleTree;
-
// Ordinal() method and value field for enums
jmethodID mOrdinal;
jfieldID mTextSizeValue;
+
+#if ENABLE(DATABASE)
+ jfieldID mDatabaseEnabled;
+#endif
+#if ENABLE(DOM_STORAGE)
+ jfieldID mDomStorageEnabled;
+#endif
+#if ENABLE(DATABASE) || ENABLE(DOM_STORAGE)
+ jfieldID mDatabasePath;
+#endif
};
static struct FieldIds* gFieldIds;
@@ -273,47 +289,17 @@ 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 ENABLE(OFFLINE_WEB_APPLICATIONS)
+ flag = env->GetBooleanField(obj, gFieldIds->mAppCacheEnabled);
+ s->setOfflineWebApplicationCacheEnabled(flag);
+ str = (jstring)env->GetObjectField(obj, gFieldIds->mAppCachePath);
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.
- 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);
+ WebCore::String path = to_string(env, str);
+ if (path.length()) {
+ WebCore::cacheStorage().setCacheDirectory(path);
}
}
#endif
-
flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptCanOpenWindowsAutomatically);
s->setJavaScriptCanOpenWindowsAutomatically(flag);
@@ -328,9 +314,22 @@ public:
#endif
flag = env->GetBooleanField(obj, gFieldIds->mShrinksStandaloneImagesToFit);
s->setShrinksStandaloneImagesToFit(flag);
-#if USE(LOW_BANDWIDTH_DISPLAY)
- flag = env->GetBooleanField(obj, gFieldIds->mUseDoubleTree);
- pFrame->loader()->setUseLowBandwidthDisplay(flag);
+#if ENABLE(DATABASE)
+ flag = env->GetBooleanField(obj, gFieldIds->mDatabaseEnabled);
+ s->setDatabasesEnabled(flag);
+ str = (jstring)env->GetObjectField(obj, gFieldIds->mDatabasePath);
+ WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(to_string(env, str));
+#endif
+#if ENABLE(DOM_STORAGE)
+ flag = env->GetBooleanField(obj, gFieldIds->mDomStorageEnabled);
+ s->setLocalStorageEnabled(flag);
+ str = (jstring)env->GetObjectField(obj, gFieldIds->mDatabasePath);
+ if (str) {
+ WebCore::String localStorageDatabasePath = to_string(env,str);
+ if (localStorageDatabasePath.length()) {
+ s->setLocalStorageDatabasePath(localStorageDatabasePath);
+ }
+ }
#endif
}
};