OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 virtual ~URLBlacklistManager(); | 102 virtual ~URLBlacklistManager(); |
103 | 103 |
104 // Must be called on the UI thread, before destruction. | 104 // Must be called on the UI thread, before destruction. |
105 void ShutdownOnUIThread(); | 105 void ShutdownOnUIThread(); |
106 | 106 |
107 // Returns true if |url| is blocked by the current blacklist. Must be called | 107 // Returns true if |url| is blocked by the current blacklist. Must be called |
108 // from the IO thread. | 108 // from the IO thread. |
109 bool IsURLBlocked(const GURL& url) const; | 109 bool IsURLBlocked(const GURL& url) const; |
110 | 110 |
111 // Replaces the current blacklist. Must be called on the IO thread. | 111 // Replaces the current blacklist. Must be called on the IO thread. |
112 void SetBlacklist(URLBlacklist* blacklist); | 112 void SetBlacklist(scoped_ptr<URLBlacklist> blacklist); |
113 | 113 |
114 // Registers the preferences related to blacklisting in the given PrefService. | 114 // Registers the preferences related to blacklisting in the given PrefService. |
115 static void RegisterPrefs(PrefService* pref_service); | 115 static void RegisterPrefs(PrefService* pref_service); |
116 | 116 |
117 protected: | 117 protected: |
118 typedef std::vector<std::string> StringVector; | 118 typedef std::vector<std::string> StringVector; |
119 | 119 |
120 // Used to delay updating the blacklist while the preferences are | 120 // Used to delay updating the blacklist while the preferences are |
121 // changing, and execute only one update per simultaneous prefs changes. | 121 // changing, and execute only one update per simultaneous prefs changes. |
122 void ScheduleUpdate(); | 122 void ScheduleUpdate(); |
123 | 123 |
124 // Updates the blacklist using the current preference values. | 124 // Updates the blacklist using the current preference values. |
125 // Virtual for testing. | 125 // Virtual for testing. |
126 virtual void Update(); | 126 virtual void Update(); |
127 | 127 |
128 // Starts the blacklist update on the IO thread, using the filters in | 128 // Starts the blacklist update on the IO thread, using the filters in |
129 // |block| and |allow|. Protected for testing. | 129 // |block| and |allow|. Protected for testing. |
130 void UpdateOnIO(StringVector* block, StringVector* allow); | 130 void UpdateOnIO(scoped_ptr<StringVector> block, |
| 131 scoped_ptr<StringVector> allow); |
131 | 132 |
132 private: | 133 private: |
133 virtual void Observe(int type, | 134 virtual void Observe(int type, |
134 const content::NotificationSource& source, | 135 const content::NotificationSource& source, |
135 const content::NotificationDetails& details) OVERRIDE; | 136 const content::NotificationDetails& details) OVERRIDE; |
136 | 137 |
137 // --------- | 138 // --------- |
138 // UI thread | 139 // UI thread |
139 // --------- | 140 // --------- |
140 | 141 |
(...skipping 13 matching lines...) Expand all Loading... |
154 | 155 |
155 // The current blacklist. | 156 // The current blacklist. |
156 scoped_ptr<URLBlacklist> blacklist_; | 157 scoped_ptr<URLBlacklist> blacklist_; |
157 | 158 |
158 DISALLOW_COPY_AND_ASSIGN(URLBlacklistManager); | 159 DISALLOW_COPY_AND_ASSIGN(URLBlacklistManager); |
159 }; | 160 }; |
160 | 161 |
161 } // namespace policy | 162 } // namespace policy |
162 | 163 |
163 #endif // CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_ | 164 #endif // CHROME_BROWSER_POLICY_URL_BLACKLIST_MANAGER_H_ |
OLD | NEW |