summaryrefslogtreecommitdiffstats
path: root/chrome/browser/notifications/notifications_prefs_cache.h
diff options
context:
space:
mode:
authorthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-03 02:29:52 +0000
committerthakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-03 02:29:52 +0000
commit78dcb900b1ae1209d87cd746c1ff7d4c13f9f04e (patch)
tree716fc33ee1e0c300f6b56e5921c7b183258458d3 /chrome/browser/notifications/notifications_prefs_cache.h
parent1350815259420160cfd2bdf8d94fbf9f80bc379b (diff)
downloadchromium_src-78dcb900b1ae1209d87cd746c1ff7d4c13f9f04e.zip
chromium_src-78dcb900b1ae1209d87cd746c1ff7d4c13f9f04e.tar.gz
chromium_src-78dcb900b1ae1209d87cd746c1ff7d4c13f9f04e.tar.bz2
Add a default content setting to the notifications service.
Not yet used anywhere, no behavior change. BUG=45547 TEST=none (unit tests) Review URL: http://codereview.chromium.org/2842043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51587 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/notifications/notifications_prefs_cache.h')
-rw-r--r--chrome/browser/notifications/notifications_prefs_cache.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/chrome/browser/notifications/notifications_prefs_cache.h b/chrome/browser/notifications/notifications_prefs_cache.h
index 1b87a29..e12fa14 100644
--- a/chrome/browser/notifications/notifications_prefs_cache.h
+++ b/chrome/browser/notifications/notifications_prefs_cache.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -9,6 +9,7 @@
#include <vector>
#include "base/ref_counted.h"
+#include "chrome/common/content_settings.h"
#include "googleurl/src/gurl.h"
class ListValue;
@@ -22,6 +23,8 @@ class NotificationsPrefsCache
public:
NotificationsPrefsCache();
+ // Once is_initialized_() is set, all accesses must happen on the IO thread.
+ // Before that, all accesses need to happen on the UI thread.
void set_is_initialized(bool val) { is_initialized_ = val; }
bool is_initialized() { return is_initialized_; }
@@ -38,10 +41,16 @@ class NotificationsPrefsCache
// contents of the cache.
void SetCacheAllowedOrigins(const std::vector<GURL>& allowed);
void SetCacheDeniedOrigins(const std::vector<GURL>& denied);
+ void SetCacheDefaultContentSetting(ContentSetting setting);
static void ListValueToGurlVector(const ListValue& origin_list,
std::vector<GURL>* origin_vector);
+ // Exposed for testing.
+ ContentSetting CachedDefaultContentSetting() {
+ return default_content_setting_;
+ }
+
private:
friend class base::RefCountedThreadSafe<NotificationsPrefsCache>;
@@ -58,6 +67,10 @@ class NotificationsPrefsCache
std::set<GURL> allowed_origins_;
std::set<GURL> denied_origins_;
+ // The default setting, used for origins that are neither in
+ // |allowed_origins_| nor |denied_origins_|.
+ ContentSetting default_content_setting_;
+
// Set to true once the initial cached settings have been completely read.
// Once this is done, the class can no longer be accessed on the UI thread.
bool is_initialized_;