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

Side by Side Diff: chrome/browser/notifications/notifications_prefs_cache.h

Issue 2868042: Backend changes for notifications content settings. (Closed)
Patch Set: '' Created 10 years, 5 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/notifications/notification_exceptions_table_model_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATIONS_PREFS_CACHE_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATIONS_PREFS_CACHE_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATIONS_PREFS_CACHE_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATIONS_PREFS_CACHE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "chrome/common/content_settings.h" 12 #include "chrome/common/content_settings.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 14
15 class ListValue; 15 class ListValue;
16 16
17 // Class which caches notification preferences. 17 // Class which caches notification preferences.
18 // Construction occurs on the UI thread when the contents 18 // Construction occurs on the UI thread when the contents
19 // of the profile preferences are initialized. Once is_initialized() is set, 19 // of the profile preferences are initialized. Once is_initialized() is set,
20 // access can only be done from the IO thread. 20 // access can only be done from the IO thread.
21 class NotificationsPrefsCache 21 class NotificationsPrefsCache
22 : public base::RefCountedThreadSafe<NotificationsPrefsCache> { 22 : public base::RefCountedThreadSafe<NotificationsPrefsCache> {
23 public: 23 public:
24 NotificationsPrefsCache(); 24 NotificationsPrefsCache();
25 25
26 // Once is_initialized_() is set, all accesses must happen on the IO thread. 26 // Once is_initialized() is set, all accesses must happen on the IO thread.
27 // Before that, all accesses need to happen on the UI thread. 27 // Before that, all accesses need to happen on the UI thread.
28 void set_is_initialized(bool val) { is_initialized_ = val; } 28 void set_is_initialized(bool val) { is_initialized_ = val; }
29 bool is_initialized() { return is_initialized_; } 29 bool is_initialized() { return is_initialized_; }
30 30
31 // Checks to see if a given origin has permission to create desktop 31 // Checks to see if a given origin has permission to create desktop
32 // notifications. Returns a constant from WebNotificationPresenter 32 // notifications. Returns a constant from WebNotificationPresenter
33 // class. 33 // class.
34 int HasPermission(const GURL& origin); 34 int HasPermission(const GURL& origin);
35 35
36 // Updates the cache with a new origin allowed or denied. 36 // Updates the cache with a new origin allowed or denied.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 ContentSetting default_content_setting_; 72 ContentSetting default_content_setting_;
73 73
74 // Set to true once the initial cached settings have been completely read. 74 // Set to true once the initial cached settings have been completely read.
75 // Once this is done, the class can no longer be accessed on the UI thread. 75 // Once this is done, the class can no longer be accessed on the UI thread.
76 bool is_initialized_; 76 bool is_initialized_;
77 77
78 DISALLOW_COPY_AND_ASSIGN(NotificationsPrefsCache); 78 DISALLOW_COPY_AND_ASSIGN(NotificationsPrefsCache);
79 }; 79 };
80 80
81 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATIONS_PREFS_CACHE_H_ 81 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATIONS_PREFS_CACHE_H_
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notification_exceptions_table_model_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698