Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java |
index c6a613d2baface1e08f2b083a5fd74392be2eef9..66cf2286599cc016956c5d4eda43d22c603ee6ce 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/PrefServiceBridge.java |
@@ -14,6 +14,7 @@ import org.chromium.base.CalledByNative; |
import org.chromium.base.ThreadUtils; |
import org.chromium.chrome.browser.preferences.website.ContentSetting; |
import org.chromium.chrome.browser.preferences.website.GeolocationInfo; |
+import org.chromium.chrome.browser.preferences.website.ImagesExceptionInfo; |
import org.chromium.chrome.browser.preferences.website.JavaScriptExceptionInfo; |
import org.chromium.chrome.browser.preferences.website.PopupExceptionInfo; |
import org.chromium.chrome.browser.preferences.website.WebsitePreferenceBridge; |
@@ -667,6 +668,27 @@ public final class PrefServiceBridge { |
} |
/** |
+ * @return Whether the images permission is enabled. |
+ */ |
+ public boolean imagesEnabled() { |
newt (away)
2015/04/09 23:43:20
"areImagesEnabled()" and "areImagesManaged()". als
Finnur
2015/04/10 17:03:25
Done.
|
+ return nativeGetImagesEnabled(); |
+ } |
+ |
+ /** |
+ * @return whether Images is managed by policy |
+ */ |
+ public boolean imagesManaged() { |
+ return nativeGetImagesManaged(); |
+ } |
+ |
+ /** |
+ * Sets the preferences on whether to enable/disable images. |
newt (away)
2015/04/09 23:43:20
Sets whether webpages are allowed to load images.
Finnur
2015/04/10 17:03:25
Done.
|
+ */ |
+ public void setImagesEnabled(boolean enabled) { |
+ nativeSetImagesEnabled(enabled); |
+ } |
+ |
+ /** |
* @return Whether the camera/microphone permission is enabled. |
*/ |
public boolean isCameraMicEnabled() { |
@@ -724,6 +746,48 @@ public final class PrefServiceBridge { |
} |
/** |
+ * Sets whether Images are allowed to show on the given website/domain. |
newt (away)
2015/04/09 23:43:20
s/Images/images
Finnur
2015/04/10 17:03:25
Done.
|
+ * |
+ * @param pattern A pattern that matches one or multiple domains. For |
+ * details see examples in content_settings_pattern.h. |
+ * @param allow Whether to show Images on the given site/domain. |
+ */ |
+ public void setImagesAllowed(String pattern, boolean allow) { |
+ nativeSetImagesAllowed( |
+ pattern, allow ? ContentSetting.ALLOW.toInt() : ContentSetting.BLOCK.toInt()); |
+ } |
+ |
+ /** |
+ * Removes an Images exception. |
+ * |
+ * @param pattern attribute for the Images exception pattern. |
+ */ |
+ public void removeImagesException(String pattern) { |
+ nativeSetImagesAllowed(pattern, ContentSetting.DEFAULT.toInt()); |
+ } |
+ |
+ /** |
+ * get all the currently saved Images exceptions. |
newt (away)
2015/04/09 23:43:20
s/get/Returns
Finnur
2015/04/10 17:03:25
Done.
|
+ * |
+ * @return List of all the exceptions and their settings |
+ */ |
+ public List<ImagesExceptionInfo> getImagesExceptions() { |
+ List<ImagesExceptionInfo> list = new ArrayList<ImagesExceptionInfo>(); |
+ nativeGetImagesExceptions(list); |
+ return list; |
+ } |
+ |
+ @CalledByNative |
+ private static void addImagesExceptionToList( |
+ ArrayList<ImagesExceptionInfo> list, |
+ String pattern, |
+ String setting, |
+ String source) { |
+ ImagesExceptionInfo exception = new ImagesExceptionInfo(pattern, setting, source); |
+ list.add(exception); |
+ } |
+ |
+ /** |
* Sets whether JavaScript is allowed to run on the given website/domain. |
* |
* @param pattern A pattern that matches one or multiple domains. For |
@@ -738,7 +802,7 @@ public final class PrefServiceBridge { |
/** |
* Removes a JavaScript exception. |
* |
- * @param pattern attribute for the popup exception pattern |
+ * @param pattern attribute for the Javascript exception pattern. |
*/ |
public void removeJavaScriptException(String pattern) { |
nativeSetJavaScriptAllowed(pattern, ContentSetting.DEFAULT.toInt()); |
@@ -872,7 +936,6 @@ public final class PrefServiceBridge { |
private native boolean nativeGetDoNotTrackEnabled(); |
private native boolean nativeGetPasswordEchoEnabled(); |
private native boolean nativeGetFirstRunEulaAccepted(); |
- private native boolean nativeGetJavaScriptManaged(); |
private native boolean nativeGetCameraMicUserModifiable(); |
private native boolean nativeGetCameraMicManagedByCustodian(); |
private native boolean nativeGetFullscreenAllowed(); |
@@ -890,6 +953,7 @@ public final class PrefServiceBridge { |
private native boolean nativeGetForceSafeSearch(); |
private native void nativeSetTranslateEnabled(boolean enabled); |
private native void nativeResetTranslateDefaults(); |
+ private native boolean nativeGetJavaScriptManaged(); |
private native boolean nativeGetJavaScriptEnabled(); |
private native void nativeSetJavaScriptEnabled(boolean enabled); |
private native void nativeMigrateJavascriptPreference(); |
@@ -911,6 +975,11 @@ public final class PrefServiceBridge { |
private native boolean nativeGetPushNotificationsEnabled(); |
private native void nativeSetAllowLocationEnabled(boolean allow); |
private native void nativeSetCameraMicEnabled(boolean allow); |
+ private native boolean nativeGetImagesManaged(); |
+ private native boolean nativeGetImagesEnabled(); |
+ private native void nativeSetImagesEnabled(boolean allow); |
+ private native void nativeSetImagesAllowed(String pattern, int setting); |
+ private native void nativeGetImagesExceptions(List<ImagesExceptionInfo> list); |
private native void nativeSetPushNotificationsEnabled(boolean allow); |
private native void nativeSetPasswordEchoEnabled(boolean enabled); |
private native boolean nativeGetAllowPopupsEnabled(); |