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 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 5 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <set> | 10 #include <set> |
8 #include <utility> | 11 #include <utility> |
9 | 12 |
10 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
11 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
12 #include "base/json/json_file_value_serializer.h" | 15 #include "base/json/json_file_value_serializer.h" |
| 16 #include "base/macros.h" |
13 #include "base/sha1.h" | 17 #include "base/sha1.h" |
14 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
16 #include "base/task_runner_util.h" | 20 #include "base/task_runner_util.h" |
17 #include "base/threading/sequenced_worker_pool.h" | 21 #include "base/threading/sequenced_worker_pool.h" |
18 #include "chrome/browser/supervised_user/experimental/supervised_user_async_url_
checker.h" | 22 #include "chrome/browser/supervised_user/experimental/supervised_user_async_url_
checker.h" |
19 #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist.
h" | 23 #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist.
h" |
20 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
21 #include "components/policy/core/browser/url_blacklist_manager.h" | 25 #include "components/policy/core/browser/url_blacklist_manager.h" |
22 #include "components/url_formatter/url_fixer.h" | 26 #include "components/url_formatter/url_fixer.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 : contents_(new SupervisedUserURLFilter::Contents()), | 99 : contents_(new SupervisedUserURLFilter::Contents()), |
96 matcher_id_(0) {} | 100 matcher_id_(0) {} |
97 | 101 |
98 FilterBuilder::~FilterBuilder() { | 102 FilterBuilder::~FilterBuilder() { |
99 DCHECK(!contents_.get()); | 103 DCHECK(!contents_.get()); |
100 } | 104 } |
101 | 105 |
102 bool FilterBuilder::AddPattern(const std::string& pattern) { | 106 bool FilterBuilder::AddPattern(const std::string& pattern) { |
103 std::string scheme; | 107 std::string scheme; |
104 std::string host; | 108 std::string host; |
105 uint16 port = 0; | 109 uint16_t port = 0; |
106 std::string path; | 110 std::string path; |
107 std::string query; | 111 std::string query; |
108 bool match_subdomains = true; | 112 bool match_subdomains = true; |
109 URLBlacklist::SegmentURLCallback callback = | 113 URLBlacklist::SegmentURLCallback callback = |
110 static_cast<URLBlacklist::SegmentURLCallback>(url_formatter::SegmentURL); | 114 static_cast<URLBlacklist::SegmentURLCallback>(url_formatter::SegmentURL); |
111 if (!URLBlacklist::FilterToComponents( | 115 if (!URLBlacklist::FilterToComponents( |
112 callback, pattern, | 116 callback, pattern, |
113 &scheme, &host, &match_subdomains, &port, &path, &query)) { | 117 &scheme, &host, &match_subdomains, &port, &path, &query)) { |
114 LOG(ERROR) << "Invalid pattern " << pattern; | 118 LOG(ERROR) << "Invalid pattern " << pattern; |
115 return false; | 119 return false; |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 const FilteringBehaviorCallback& callback, | 457 const FilteringBehaviorCallback& callback, |
454 const GURL& url, | 458 const GURL& url, |
455 FilteringBehavior behavior, | 459 FilteringBehavior behavior, |
456 bool uncertain) const { | 460 bool uncertain) const { |
457 DCHECK(default_behavior_ != BLOCK); | 461 DCHECK(default_behavior_ != BLOCK); |
458 | 462 |
459 callback.Run(behavior, ASYNC_CHECKER, uncertain); | 463 callback.Run(behavior, ASYNC_CHECKER, uncertain); |
460 FOR_EACH_OBSERVER(Observer, observers_, | 464 FOR_EACH_OBSERVER(Observer, observers_, |
461 OnURLChecked(url, behavior, ASYNC_CHECKER, uncertain)); | 465 OnURLChecked(url, behavior, ASYNC_CHECKER, uncertain)); |
462 } | 466 } |
OLD | NEW |