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

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

Issue 1068223002: Implement Site Settings \ Images category. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and fix merge conflict 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/ContentSettingException.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/ContentSettingException.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/ContentSettingException.java
new file mode 100644
index 0000000000000000000000000000000000000000..168eb35e4fad65af7aeea04c52e4cd44da868f75
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/ContentSettingException.java
@@ -0,0 +1,75 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.preferences.website;
+
+import org.chromium.base.annotations.SuppressFBWarnings;
+import org.chromium.chrome.browser.preferences.PrefServiceBridge;
+
+import java.io.Serializable;
+
+/**
+ * Exception information for a given origin.
+ */
+@SuppressFBWarnings("NM_CLASS_NOT_EXCEPTION")
+public class ContentSettingException implements Serializable {
+ private final int mContentSettingType;
+ private final String mPattern;
+ private final String mSetting;
+ private final String mSource;
+
+ /**
+ * Construct a ContentSettingException.
+ * @param type The content setting type this exception covers.
+ * @param pattern The host/domain pattern this exception covers.
+ * @param source The source for this exception, e.g. "policy".
+ */
+ public ContentSettingException(
+ int type, String pattern, String setting, String source) {
+ mContentSettingType = type;
+ mPattern = pattern;
+ mSetting = setting;
+ mSource = source;
+ }
+
+ public String getPattern() {
+ return mPattern;
+ }
+
+ public String getSetting() {
+ return mSetting;
+ }
+
+ public String getSource() {
+ return mSource;
+ }
+
+ /**
+ * Returns the content setting value for this pattern, if one exists.
+ */
+ public ContentSetting getContentSetting() {
+ if (mSetting.equals(PrefServiceBridge.EXCEPTION_SETTING_ALLOW)) {
+ return ContentSetting.ALLOW;
+ } else if (mSetting.equals(PrefServiceBridge.EXCEPTION_SETTING_BLOCK)) {
+ return ContentSetting.BLOCK;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Sets the content setting value for this pattern.
+ */
+ public void setContentSetting(ContentSetting value) {
+ if (value != null) {
+ PrefServiceBridge.getInstance().nativeSetContentSettingForPattern(
+ mContentSettingType, mPattern, value == ContentSetting.ALLOW
+ ? ContentSetting.ALLOW.toInt()
+ : ContentSetting.BLOCK.toInt());
+ } else {
+ PrefServiceBridge.getInstance().nativeSetContentSettingForPattern(
+ mContentSettingType, mPattern, ContentSetting.DEFAULT.toInt());
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698