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> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // - If the pattern starts with "*.", it matches the host or any subdomain | 96 // - If the pattern starts with "*.", it matches the host or any subdomain |
97 // (e.g. the pattern "*.google.com" would match google.com, www.google.com, | 97 // (e.g. the pattern "*.google.com" would match google.com, www.google.com, |
98 // or accounts.google.com). | 98 // or accounts.google.com). |
99 // - If the pattern ends with ".*", it matches the host on any known TLD | 99 // - If the pattern ends with ".*", it matches the host on any known TLD |
100 // (e.g. the pattern "google.*" would match google.com or google.co.uk). | 100 // (e.g. the pattern "google.*" would match google.com or google.co.uk). |
101 // See the SupervisedUserURLFilterTest.HostMatchesPattern unit test for more | 101 // See the SupervisedUserURLFilterTest.HostMatchesPattern unit test for more |
102 // examples. | 102 // examples. |
103 // Asterisks in other parts of the pattern are not allowed. | 103 // Asterisks in other parts of the pattern are not allowed. |
104 // |host| and |pattern| are assumed to be normalized to lower-case. | 104 // |host| and |pattern| are assumed to be normalized to lower-case. |
105 // This method is public for testing. | 105 // This method is public for testing. |
106 static bool HostMatchesPattern(const std::string& host, | 106 static bool HostMatchesPattern(const std::string& canonical_host, |
107 const std::string& pattern); | 107 const std::string& pattern); |
108 | 108 |
109 // Returns the filtering behavior for a given URL, based on the default | 109 // Returns the filtering behavior for a given URL, based on the default |
110 // behavior and whether it is on a site list. | 110 // behavior and whether it is on a site list. |
111 FilteringBehavior GetFilteringBehaviorForURL(const GURL& url) const; | 111 FilteringBehavior GetFilteringBehaviorForURL(const GURL& url) const; |
112 | 112 |
113 // Checks for a manual setting (i.e. manual exceptions and content packs) | 113 // Checks for a manual setting (i.e. manual exceptions and content packs) |
114 // for the given URL. If there is one, returns true and writes the result | 114 // for the given URL. If there is one, returns true and writes the result |
115 // into |behavior|. Otherwise returns false; in this case the value of | 115 // into |behavior|. Otherwise returns false; in this case the value of |
116 // |behavior| is unspecified. | 116 // |behavior| is unspecified. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 re2::RE2 amp_cache_path_regex_; | 217 re2::RE2 amp_cache_path_regex_; |
218 re2::RE2 google_amp_viewer_path_regex_; | 218 re2::RE2 google_amp_viewer_path_regex_; |
219 re2::RE2 google_web_cache_query_regex_; | 219 re2::RE2 google_web_cache_query_regex_; |
220 | 220 |
221 scoped_refptr<base::TaskRunner> blocking_task_runner_; | 221 scoped_refptr<base::TaskRunner> blocking_task_runner_; |
222 | 222 |
223 DISALLOW_COPY_AND_ASSIGN(SupervisedUserURLFilter); | 223 DISALLOW_COPY_AND_ASSIGN(SupervisedUserURLFilter); |
224 }; | 224 }; |
225 | 225 |
226 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_URL_FILTER_H_ | 226 #endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_URL_FILTER_H_ |
OLD | NEW |