| 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);
|
| + }
|
| + }
|
| +}
|
|
|