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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/website/ContentSettingExceptionInfo.java

Issue 1068223002: Implement Site Settings \ Images category. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback + cleanup Created 5 years, 8 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: chrome/android/java/src/org/chromium/chrome/browser/preferences/website/ContentSettingExceptionInfo.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/JavaScriptExceptionInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/ContentSettingExceptionInfo.java
similarity index 57%
rename from chrome/android/java/src/org/chromium/chrome/browser/preferences/website/JavaScriptExceptionInfo.java
rename to chrome/android/java/src/org/chromium/chrome/browser/preferences/website/ContentSettingExceptionInfo.java
index dfc7697ae7955c539b4b592cdba90e7ff8b68ca7..6120f66d311746f2e2636159b9ef7d023cbd02b4 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/JavaScriptExceptionInfo.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/ContentSettingExceptionInfo.java
@@ -9,14 +9,17 @@ import org.chromium.chrome.browser.preferences.PrefServiceBridge;
import java.io.Serializable;
/**
- * JavaScript exception information for a given URL pattern.
+ * Images exception information for a given origin.
newt (away) 2015/04/10 18:46:49 Update comments not to mention "images"
Finnur 2015/04/13 12:59:32 Done.
*/
-public class JavaScriptExceptionInfo implements Serializable {
+public class ContentSettingExceptionInfo implements Serializable {
newt (away) 2015/04/10 18:46:49 I'd remove "Info" from the name. ContentSettingExc
Finnur 2015/04/13 12:59:32 I agree. However, I renamed the class and findbug
newt (away) 2015/04/13 22:49:06 You can use an annotation to suppress the warning.
+ private final int mContentSettingType;
private final String mPattern;
private final String mSetting;
private final String mSource;
- public JavaScriptExceptionInfo(String pattern, String setting, String source) {
+ public ContentSettingExceptionInfo(
+ int type, String pattern, String setting, String source) {
+ mContentSettingType = type;
mPattern = pattern;
mSetting = setting;
mSource = source;
@@ -27,7 +30,7 @@ public class JavaScriptExceptionInfo implements Serializable {
}
public String getSetting() {
- return mPattern;
+ return mSetting;
}
public String getSource() {
@@ -35,7 +38,7 @@ public class JavaScriptExceptionInfo implements Serializable {
}
/**
- * @return The ContentSetting specifying whether popups are allowed for this pattern.
+ * @return The ContentSetting specifying whether images are allowed for this pattern.
*/
public ContentSetting getContentSetting() {
if (mSetting.equals(PrefServiceBridge.EXCEPTION_SETTING_ALLOW)) {
@@ -48,14 +51,17 @@ public class JavaScriptExceptionInfo implements Serializable {
}
/**
- * Sets whether popups are allowed for this pattern.
+ * Sets whether images are allowed for this pattern.
*/
public void setContentSetting(ContentSetting value) {
if (value != null) {
- PrefServiceBridge.getInstance().setJavaScriptAllowed(
- mPattern, value == ContentSetting.ALLOW ? true : false);
+ PrefServiceBridge.getInstance().nativeSetContentSettingForPattern(
+ mContentSettingType, mPattern, value == ContentSetting.ALLOW
+ ? ContentSetting.ALLOW.toInt()
+ : ContentSetting.BLOCK.toInt());
} else {
- PrefServiceBridge.getInstance().removeJavaScriptException(mPattern);
+ PrefServiceBridge.getInstance().nativeSetContentSettingForPattern(
+ mContentSettingType, mPattern, ContentSetting.DEFAULT.toInt());
}
}
-}
+}

Powered by Google App Engine
This is Rietveld 408576698