OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_POLICY_CORE_BROWSER_URL_BLACKLIST_MANAGER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_BROWSER_URL_BLACKLIST_MANAGER_H_ |
6 #define COMPONENTS_POLICY_CORE_BROWSER_URL_BLACKLIST_MANAGER_H_ | 6 #define COMPONENTS_POLICY_CORE_BROWSER_URL_BLACKLIST_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // Starts the blacklist update on the IO thread, using the filters in | 189 // Starts the blacklist update on the IO thread, using the filters in |
190 // |block| and |allow|. Protected for testing. | 190 // |block| and |allow|. Protected for testing. |
191 void UpdateOnIO(scoped_ptr<base::ListValue> block, | 191 void UpdateOnIO(scoped_ptr<base::ListValue> block, |
192 scoped_ptr<base::ListValue> allow); | 192 scoped_ptr<base::ListValue> allow); |
193 | 193 |
194 private: | 194 private: |
195 // --------- | 195 // --------- |
196 // UI thread | 196 // UI thread |
197 // --------- | 197 // --------- |
198 | 198 |
199 // Used to post update tasks to the UI thread. | |
200 base::WeakPtrFactory<URLBlacklistManager> ui_weak_ptr_factory_; | |
201 | |
202 // Used to track the policies and update the blacklist on changes. | 199 // Used to track the policies and update the blacklist on changes. |
203 PrefChangeRegistrar pref_change_registrar_; | 200 PrefChangeRegistrar pref_change_registrar_; |
204 PrefService* pref_service_; // Weak. | 201 PrefService* pref_service_; // Weak. |
205 | 202 |
206 // Used to post tasks to a background thread. | 203 // Used to post tasks to a background thread. |
207 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; | 204 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
208 | 205 |
209 // Used to post tasks to the IO thread. | 206 // Used to post tasks to the IO thread. |
210 scoped_refptr<base::SequencedTaskRunner> io_task_runner_; | 207 scoped_refptr<base::SequencedTaskRunner> io_task_runner_; |
211 | 208 |
212 // Used to break a URL into its components. | 209 // Used to break a URL into its components. |
213 URLBlacklist::SegmentURLCallback segment_url_; | 210 URLBlacklist::SegmentURLCallback segment_url_; |
214 | 211 |
215 // Used to optionally skip blacklisting for some URLs. | 212 // Used to optionally skip blacklisting for some URLs. |
216 OverrideBlacklistCallback override_blacklist_; | 213 OverrideBlacklistCallback override_blacklist_; |
217 | 214 |
218 // --------- | 215 // --------- |
219 // IO thread | 216 // IO thread |
220 // --------- | 217 // --------- |
221 | 218 |
222 // Used to get |weak_ptr_| to self on the IO thread. | |
223 base::WeakPtrFactory<URLBlacklistManager> io_weak_ptr_factory_; | |
224 | |
225 // Used to post tasks to the UI thread. | 219 // Used to post tasks to the UI thread. |
226 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 220 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
227 | 221 |
228 // The current blacklist. | 222 // The current blacklist. |
229 scoped_ptr<URLBlacklist> blacklist_; | 223 scoped_ptr<URLBlacklist> blacklist_; |
230 | 224 |
| 225 // Used to post update tasks to the UI thread. |
| 226 base::WeakPtrFactory<URLBlacklistManager> ui_weak_ptr_factory_; |
| 227 |
| 228 // Used to get |weak_ptr_| to self on the IO thread. |
| 229 base::WeakPtrFactory<URLBlacklistManager> io_weak_ptr_factory_; |
| 230 |
231 DISALLOW_COPY_AND_ASSIGN(URLBlacklistManager); | 231 DISALLOW_COPY_AND_ASSIGN(URLBlacklistManager); |
232 }; | 232 }; |
233 | 233 |
234 } // namespace policy | 234 } // namespace policy |
235 | 235 |
236 #endif // COMPONENTS_POLICY_CORE_BROWSER_URL_BLACKLIST_MANAGER_H_ | 236 #endif // COMPONENTS_POLICY_CORE_BROWSER_URL_BLACKLIST_MANAGER_H_ |
OLD | NEW |