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

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: Update ContentSetting to new locking semantics. Add a test that does not require http server. 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
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..2f51565f87186a5ee9236e50139ea0579c6dad81 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,7 @@ public class ContentSettings {
/**
* Tell the WebView to load image resources automatically.
+ * Note that this does not block image loads from WebCore cache.
mnaganov (inactive) 2012/09/25 09:55:53 ...that setting this flag to false does not block.
* @param flag True if the WebView should load images automatically.
*/
public void setLoadsImagesAutomatically(boolean flag) {
@@ -747,6 +749,33 @@ 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 LoadsImagesAutomatically, this will block image loads
mnaganov (inactive) 2012/09/25 09:55:53 LoadImagesAutomatically -> {@link #setLoadsImagesA
mnaganov (inactive) 2012/09/25 09:55:53 ...setting this flag to false will block...
+ * from WebCore cache as well.
mnaganov (inactive) 2012/09/25 09:55:53 Please add "The default is true."
+ * @param flag True if the WebView should enable images.
mnaganov (inactive) 2012/09/25 09:55:53 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.

Powered by Google App Engine
This is Rietveld 408576698