| 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 class PrefRegistrySyncable; |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 class ListValue; | 25 class ListValue; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace policy { | 28 namespace policy { |
| 29 | 29 |
| 30 // 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 |
| 31 // against this set. The filters are currently kept in memory. | 31 // against this set. The filters are currently kept in memory. |
| 32 class URLBlacklist { | 32 class URLBlacklist { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 // Returns true if |url| is blocked by the current blacklist. Must be called | 128 // Returns true if |url| is blocked by the current blacklist. Must be called |
| 129 // from the IO thread. | 129 // from the IO thread. |
| 130 bool IsURLBlocked(const GURL& url) const; | 130 bool IsURLBlocked(const GURL& url) const; |
| 131 | 131 |
| 132 // Replaces the current blacklist. Must be called on the IO thread. | 132 // Replaces the current blacklist. Must be called on the IO thread. |
| 133 // Virtual for testing. | 133 // Virtual for testing. |
| 134 virtual void SetBlacklist(scoped_ptr<URLBlacklist> blacklist); | 134 virtual void SetBlacklist(scoped_ptr<URLBlacklist> blacklist); |
| 135 | 135 |
| 136 // Registers the preferences related to blacklisting in the given PrefService. | 136 // Registers the preferences related to blacklisting in the given PrefService. |
| 137 static void RegisterUserPrefs(PrefServiceSyncable* pref_service); | 137 static void RegisterUserPrefs(PrefRegistrySyncable* registry); |
| 138 | 138 |
| 139 protected: | 139 protected: |
| 140 // Used to delay updating the blacklist while the preferences are | 140 // Used to delay updating the blacklist while the preferences are |
| 141 // changing, and execute only one update per simultaneous prefs changes. | 141 // changing, and execute only one update per simultaneous prefs changes. |
| 142 void ScheduleUpdate(); | 142 void ScheduleUpdate(); |
| 143 | 143 |
| 144 // Updates the blacklist using the current preference values. | 144 // Updates the blacklist using the current preference values. |
| 145 // Virtual for testing. | 145 // Virtual for testing. |
| 146 virtual void Update(); | 146 virtual void Update(); |
| 147 | 147 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 171 | 171 |
| 172 // The current blacklist. | 172 // The current blacklist. |
| 173 scoped_ptr<URLBlacklist> blacklist_; | 173 scoped_ptr<URLBlacklist> blacklist_; |
| 174 | 174 |
| 175 DISALLOW_COPY_AND_ASSIGN(URLBlacklistManager); | 175 DISALLOW_COPY_AND_ASSIGN(URLBlacklistManager); |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 } // namespace policy | 178 } // namespace policy |
| 179 | 179 |
| 180 #endif // CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_ | 180 #endif // CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_ |
| OLD | NEW |