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

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

Issue 850813002: Upstream Site Settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@location_settings_singleton
Patch Set: Created 5 years, 11 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/PopupExceptionInfo.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/PopupExceptionInfo.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/PopupExceptionInfo.java
new file mode 100644
index 0000000000000000000000000000000000000000..9742f32caa9d837da8b13101c54cc711034bf3bb
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/website/PopupExceptionInfo.java
@@ -0,0 +1,51 @@
+// 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.chrome.browser.preferences.PrefServiceBridge;
+
+import java.io.Serializable;
+
+/**
+ * Popup exception information for a given URL pattern.
+ */
+public class PopupExceptionInfo implements Serializable {
+ private final String mPattern;
+ private final String mSetting;
+
+ public PopupExceptionInfo(String pattern, String setting) {
+ mPattern = pattern;
+ mSetting = setting;
+ }
+
+ public String getPattern() {
+ return mPattern;
+ }
+
+ /**
+ * @return The ContentSetting specifying whether popups are allowed for this pattern.
+ */
+ 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 whether popups are allowed for this pattern.
+ */
+ public void setContentSetting(ContentSetting value) {
+ if (value != null) {
+ PrefServiceBridge.getInstance().setPopupException(
+ mPattern, value == ContentSetting.ALLOW ? true : false);
+ } else {
+ PrefServiceBridge.getInstance().removePopupException(mPattern);
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698