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

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

Issue 10920033: Implement Android WebView BlockNetworkImages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add javadoc to new method in TestWebServer. Fix style nit again. Created 8 years, 3 months 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
« no previous file with comments | « content/browser/android/content_settings.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7ae55c751bc1e2d5b498be217471d4e49fb75ff5..f3b858bc20d4d80ac59c7b846fccea1f38989616 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
@@ -80,6 +80,7 @@ public class ContentSettings {
private int mDefaultFontSize = 16;
private int mDefaultFixedFontSize = 13;
private boolean mLoadsImagesAutomatically = true;
+ private boolean mImagesEnabled = true;
private boolean mJavaScriptEnabled = false;
private boolean mAllowUniversalAccessFromFileURLs = false;
private boolean mAllowFileAccessFromFileURLs = false;
@@ -723,6 +724,8 @@ public class ContentSettings {
/**
* Tell the WebView to load image resources automatically.
+ * Note that setting this flag to false this does not block image loads
+ * from WebCore cache.
* @param flag True if the WebView should load images automatically.
*/
public void setLoadsImagesAutomatically(boolean flag) {
@@ -747,6 +750,34 @@ public class ContentSettings {
}
/**
+ * Sets whether images are enabled for this WebView. Setting this from
+ * false to true will reload the blocked images in place.
+ * Note that unlike {@link #setLoadsImagesAutomatically}, setting this
+ * flag to false this will block image loads from WebCore cache as well.
+ * The default is true.
+ * @param flag whether the WebView should enable images.
+ */
+ public void setImagesEnabled(boolean flag) {
+ assert mCanModifySettings;
+ synchronized (mContentSettingsLock) {
+ if (mImagesEnabled != flag) {
+ mImagesEnabled = flag;
+ mEventHandler.syncSettingsLocked();
+ }
+ }
+ }
+
+ /**
+ * Gets whether images are enabled for this WebView.
+ * @return true if the WebView has images eanbled
+ */
+ public boolean getImagesEnabled() {
+ synchronized (mContentSettingsLock) {
+ return mImagesEnabled;
+ }
+ }
+
+ /**
* Return true if JavaScript is enabled. <b>Note: The default is false.</b>
*
* @return True if JavaScript is enabled.
« no previous file with comments | « content/browser/android/content_settings.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698