Chromium Code Reviews| 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()); |
| } |
| } |
| -} |
| +} |