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 CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_URL_FILTER_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_URL_FILTER_H_ |
6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_URL_FILTER_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_URL_FILTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
18 #include "base/values.h" | 18 #include "base/values.h" |
19 #include "chrome/browser/safe_search/safe_search_url_checker.h" | |
19 #include "chrome/browser/supervised_user/supervised_user_site_list.h" | 20 #include "chrome/browser/supervised_user/supervised_user_site_list.h" |
20 #include "chrome/browser/supervised_user/supervised_users.h" | 21 #include "chrome/browser/supervised_user/supervised_users.h" |
21 #include "components/supervised_user_error_page/supervised_user_error_page.h" | 22 #include "components/supervised_user_error_page/supervised_user_error_page.h" |
22 | 23 |
23 class GURL; | 24 class GURL; |
24 class SupervisedUserBlacklist; | 25 class SupervisedUserBlacklist; |
25 | 26 |
26 namespace net { | 27 namespace net { |
27 class URLRequestContextGetter; | 28 class URLRequestContextGetter; |
28 } | 29 } |
29 | 30 |
30 class GURL; | 31 class GURL; |
31 class SupervisedUserAsyncURLChecker; | 32 class SafeSearchURLChecker; |
Marc Treib
2016/10/06 13:16:42
Not needed if you include the header anyway.
msramek
2016/10/06 15:08:41
Done.
| |
32 | 33 |
33 // This class manages the filtering behavior for a given URL, i.e. it tells | 34 // This class manages the filtering behavior for a given URL, i.e. it tells |
34 // callers if a given URL should be allowed, blocked or warned about. It uses | 35 // callers if a given URL should be allowed, blocked or warned about. It uses |
35 // information from multiple sources: | 36 // information from multiple sources: |
36 // * A default setting (allow, block or warn). | 37 // * A default setting (allow, block or warn). |
37 // * The set of installed and enabled whitelists which contain URL patterns | 38 // * The set of installed and enabled whitelists which contain URL patterns |
38 // and hostname hashes that should be allowed. | 39 // and hostname hashes that should be allowed. |
39 // * User-specified manual overrides (allow or block) for either sites | 40 // * User-specified manual overrides (allow or block) for either sites |
40 // (hostnames) or exact URLs, which take precedence over the previous | 41 // (hostnames) or exact URLs, which take precedence over the previous |
41 // sources. | 42 // sources. |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
178 | 179 |
179 void SetContents(std::unique_ptr<Contents> url_matcher); | 180 void SetContents(std::unique_ptr<Contents> url_matcher); |
180 | 181 |
181 FilteringBehavior GetFilteringBehaviorForURL( | 182 FilteringBehavior GetFilteringBehaviorForURL( |
182 const GURL& url, | 183 const GURL& url, |
183 bool manual_only, | 184 bool manual_only, |
184 supervised_user_error_page::FilteringBehaviorReason* reason) const; | 185 supervised_user_error_page::FilteringBehaviorReason* reason) const; |
185 | 186 |
186 void CheckCallback(const FilteringBehaviorCallback& callback, | 187 void CheckCallback(const FilteringBehaviorCallback& callback, |
187 const GURL& url, | 188 const GURL& url, |
188 FilteringBehavior behavior, | 189 SafeSearchURLChecker::Classification classification, |
189 bool uncertain) const; | 190 bool uncertain) const; |
190 | 191 |
191 // This is mutable to allow notification in const member functions. | 192 // This is mutable to allow notification in const member functions. |
192 mutable base::ObserverList<Observer> observers_; | 193 mutable base::ObserverList<Observer> observers_; |
193 | 194 |
194 FilteringBehavior default_behavior_; | 195 FilteringBehavior default_behavior_; |
195 std::unique_ptr<Contents> contents_; | 196 std::unique_ptr<Contents> contents_; |
196 | 197 |
197 // Maps from a URL to whether it is manually allowed (true) or blocked | 198 // Maps from a URL to whether it is manually allowed (true) or blocked |
198 // (false). | 199 // (false). |
199 std::map<GURL, bool> url_map_; | 200 std::map<GURL, bool> url_map_; |
200 | 201 |
201 // Maps from a hostname to whether it is manually allowed (true) or blocked | 202 // Maps from a hostname to whether it is manually allowed (true) or blocked |
202 // (false). | 203 // (false). |
203 std::map<std::string, bool> host_map_; | 204 std::map<std::string, bool> host_map_; |
204 | 205 |
205 // Not owned. | 206 // Not owned. |
206 const SupervisedUserBlacklist* blacklist_; | 207 const SupervisedUserBlacklist* blacklist_; |
207 | 208 |
208 std::unique_ptr<SupervisedUserAsyncURLChecker> async_url_checker_; | 209 std::unique_ptr<SafeSearchURLChecker> async_url_checker_; |
209 | 210 |
210 scoped_refptr<base::TaskRunner> blocking_task_runner_; | 211 scoped_refptr<base::TaskRunner> blocking_task_runner_; |
211 | 212 |
212 DISALLOW_COPY_AND_ASSIGN(SupervisedUserURLFilter); | 213 DISALLOW_COPY_AND_ASSIGN(SupervisedUserURLFilter); |
213 }; | 214 }; |
214 | 215 |
215 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_URL_FILTER_H_ | 216 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_URL_FILTER_H_ |
OLD | NEW |