OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_POLICY_URL_BLACKLIST_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_ |
6 #define CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_ | 6 #define CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/hash_tables.h" | 14 #include "base/hash_tables.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/prefs/public/pref_change_registrar.h" | 17 #include "base/prefs/public/pref_change_registrar.h" |
18 #include "chrome/common/extensions/matcher/url_matcher.h" | 18 #include "chrome/common/extensions/matcher/url_matcher.h" |
19 | 19 |
20 class GURL; | 20 class GURL; |
21 class PrefService; | 21 class PrefService; |
| 22 class PrefServiceSyncable; |
22 | 23 |
23 namespace base { | 24 namespace base { |
24 class ListValue; | 25 class ListValue; |
25 } | 26 } |
26 | 27 |
27 namespace policy { | 28 namespace policy { |
28 | 29 |
29 // Contains a set of filters to block and allow certain URLs, and matches GURLs | 30 // Contains a set of filters to block and allow certain URLs, and matches GURLs |
30 // against this set. The filters are currently kept in memory. | 31 // against this set. The filters are currently kept in memory. |
31 class URLBlacklist { | 32 class URLBlacklist { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 124 |
124 // Returns true if |url| is blocked by the current blacklist. Must be called | 125 // Returns true if |url| is blocked by the current blacklist. Must be called |
125 // from the IO thread. | 126 // from the IO thread. |
126 bool IsURLBlocked(const GURL& url) const; | 127 bool IsURLBlocked(const GURL& url) const; |
127 | 128 |
128 // Replaces the current blacklist. Must be called on the IO thread. | 129 // Replaces the current blacklist. Must be called on the IO thread. |
129 // Virtual for testing. | 130 // Virtual for testing. |
130 virtual void SetBlacklist(scoped_ptr<URLBlacklist> blacklist); | 131 virtual void SetBlacklist(scoped_ptr<URLBlacklist> blacklist); |
131 | 132 |
132 // Registers the preferences related to blacklisting in the given PrefService. | 133 // Registers the preferences related to blacklisting in the given PrefService. |
133 static void RegisterPrefs(PrefService* pref_service); | 134 static void RegisterUserPrefs(PrefServiceSyncable* pref_service); |
134 | 135 |
135 protected: | 136 protected: |
136 // Used to delay updating the blacklist while the preferences are | 137 // Used to delay updating the blacklist while the preferences are |
137 // changing, and execute only one update per simultaneous prefs changes. | 138 // changing, and execute only one update per simultaneous prefs changes. |
138 void ScheduleUpdate(); | 139 void ScheduleUpdate(); |
139 | 140 |
140 // Updates the blacklist using the current preference values. | 141 // Updates the blacklist using the current preference values. |
141 // Virtual for testing. | 142 // Virtual for testing. |
142 virtual void Update(); | 143 virtual void Update(); |
143 | 144 |
(...skipping 23 matching lines...) Expand all Loading... |
167 | 168 |
168 // The current blacklist. | 169 // The current blacklist. |
169 scoped_ptr<URLBlacklist> blacklist_; | 170 scoped_ptr<URLBlacklist> blacklist_; |
170 | 171 |
171 DISALLOW_COPY_AND_ASSIGN(URLBlacklistManager); | 172 DISALLOW_COPY_AND_ASSIGN(URLBlacklistManager); |
172 }; | 173 }; |
173 | 174 |
174 } // namespace policy | 175 } // namespace policy |
175 | 176 |
176 #endif // CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_ | 177 #endif // CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_ |
OLD | NEW |