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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentSettings.java

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/public/android/java/src/org/chromium/content/browser/ContentSettings.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentSettings.java b/content/public/android/java/src/org/chromium/content/browser/ContentSettings.java
index 3ccf1f1a48eb6872c6b372967cf0870402ba49d7..47e4a6b8e68bd36818c9d36812e19e9c52252405 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentSettings.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentSettings.java
@@ -78,6 +78,8 @@ public class ContentSettings {
private boolean mJavaScriptCanOpenWindowsAutomatically = false;
private boolean mSupportMultipleWindows = false;
private PluginState mPluginState = PluginState.OFF;
+ private boolean mAppCacheEnabled = false;
+ private String mAppCachePath = null;
private boolean mDomStorageEnabled = false;
// Not accessed by the native side.
@@ -919,6 +921,45 @@ public class ContentSettings {
}
/**
+ * Sets whether the Application Caches API should be enabled. The default
+ * is false. Note that in order for the Application Caches API to be
+ * enabled, a valid database path must also be supplied to
+ * {@link #setAppCachePath}.
+ *
+ * @param flag true if the WebView should enable Application Caches
+ */
+ public void setAppCacheEnabled(boolean flag) {
+ assert mCanModifySettings;
+ synchronized (mContentSettingsLock) {
+ if (mAppCacheEnabled != flag) {
+ mAppCacheEnabled = flag;
+ mEventHandler.syncSettingsLocked();
+ }
+ }
+ }
+
+ /**
+ * Sets the path to the Application Caches files. In order for the
+ * Application Caches API to be enabled, this method must be called with a
+ * path to which the application can write. This method should only be
+ * called once: repeated calls are ignored.
+ *
+ * @param appCachePath a String path to the directory containing
+ * Application Caches files.
+ * @see setAppCacheEnabled
+ */
+ public void setAppCachePath(String path) {
+ assert mCanModifySettings;
+ synchronized (mContentSettingsLock) {
+ // AppCachePath can only be set once.
+ if (mAppCachePath == null && path != null && !path.isEmpty()) {
+ mAppCachePath = path;
+ mEventHandler.syncSettingsLocked();
+ }
+ }
+ }
+
+ /**
* Sets whether the DOM storage API is enabled. The default value is false.
*
* @param flag true if the ContentView should use the DOM storage API
« content/browser/android/content_settings.cc ('K') | « content/browser/android/content_settings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698