Chromium Code Reviews| Index: chrome/browser/notifications/notifications_prefs_cache.h |
| diff --git a/chrome/browser/notifications/notifications_prefs_cache.h b/chrome/browser/notifications/notifications_prefs_cache.h |
| index 1b87a29f05157a6a76142be3f331370cd8d71450..e12fa140a32398d10c059a7eb875facb69dca0f7 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. |
|
bulach
2010/07/05 09:54:54
s/is_initialized_()/is_initialized()/
Nico
2010/07/05 15:50:14
Done.
|
| + // 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_; |