Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(450)

Unified Diff: content/browser/android/content_settings.cc

Issue 11411229: [Android] Implement WebSettings.setAppCache{Enabled|Path} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed a spurious include Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/android/content_settings.cc
diff --git a/content/browser/android/content_settings.cc b/content/browser/android/content_settings.cc
index f381672b00874500481a0eb9e365aa406c8f8a2c..dced63c54a4b54af3cd2541982d1e1fa662c8688 100644
--- a/content/browser/android/content_settings.cc
+++ b/content/browser/android/content_settings.cc
@@ -78,6 +78,10 @@ struct ContentSettings::FieldIds {
GetFieldID(env, clazz, "mJavaScriptCanOpenWindowsAutomatically", "Z");
support_multiple_windows =
GetFieldID(env, clazz, "mSupportMultipleWindows", "Z");
+ app_cache_enabled =
+ GetFieldID(env, clazz, "mAppCacheEnabled", "Z");
+ app_cache_path =
+ GetFieldID(env, clazz, "mAppCachePath", kStringClassName);
dom_storage_enabled =
GetFieldID(env, clazz, "mDomStorageEnabled", "Z");
}
@@ -103,6 +107,8 @@ struct ContentSettings::FieldIds {
jfieldID allow_file_access_from_file_urls;
jfieldID java_script_can_open_windows_automatically;
jfieldID support_multiple_windows;
+ jfieldID app_cache_enabled;
+ jfieldID app_cache_path;
jfieldID dom_storage_enabled;
};
@@ -248,6 +254,9 @@ void ContentSettings::SyncFromNativeImpl() {
Java_ContentSettings_setPluginsDisabled(env, obj, !prefs.plugins_enabled);
CheckException(env);
+ // We don't need to sync AppCache settings to Java, because there are
+ // no getters for them in the API.
+
env->SetBooleanField(
obj,
field_ids_->dom_storage_enabled,
@@ -351,6 +360,22 @@ void ContentSettings::SyncToNativeImpl() {
prefs.plugins_enabled = !Java_ContentSettings_getPluginsDisabled(env, obj);
+ // AppCachePath is a global setting across all WebViews.
+ CR_DEFINE_STATIC_LOCAL(std::string, app_cache_path, ());
boliu 2012/11/30 17:46:27 This is only global in WebViews, not inside webkit
joth 2012/11/30 22:16:59 also consider: - CR_DEFINE_STATIC_LOCAL is not thr
mnaganov (inactive) 2012/12/03 15:07:36 I know it's not thread safe, but I was supposing t
mnaganov (inactive) 2012/12/03 15:07:36 The cache storage is global in WebKit, see Applica
+ if (app_cache_path.empty()) {
+ str.Reset(
+ env, static_cast<jstring>(
+ env->GetObjectField(obj, field_ids_->app_cache_path)));
+ if (!str.is_null()) {
+ app_cache_path = ConvertJavaStringToUTF8(str);
+ // Java side should never set an empty string for the AppCache path.
+ DCHECK(!app_cache_path.empty());
+ }
+ }
+ prefs.application_cache_enabled =
+ !app_cache_path.empty() && env->GetBooleanField(
+ obj, field_ids_->app_cache_enabled);
+
prefs.local_storage_enabled = env->GetBooleanField(
obj, field_ids_->dom_storage_enabled);

Powered by Google App Engine
This is Rietveld 408576698