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 "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 scoped_refptr<URLMatcherConditionSet> condition_set = | 103 scoped_refptr<URLMatcherConditionSet> condition_set = |
104 URLBlacklist::CreateConditionSet( | 104 URLBlacklist::CreateConditionSet( |
105 &contents_->url_matcher, ++matcher_id_, | 105 &contents_->url_matcher, ++matcher_id_, |
106 scheme, host, match_subdomains, port, path, query, true); | 106 scheme, host, match_subdomains, port, path, query, true); |
107 all_conditions_.push_back(condition_set); | 107 all_conditions_.push_back(condition_set); |
108 contents_->matcher_site_map[matcher_id_] = site_id; | 108 contents_->matcher_site_map[matcher_id_] = site_id; |
109 return true; | 109 return true; |
110 } | 110 } |
111 | 111 |
112 void FilterBuilder::AddHostnameHash(const std::string& hash, int site_id) { | 112 void FilterBuilder::AddHostnameHash(const std::string& hash, int site_id) { |
113 contents_->hash_site_map.insert(std::make_pair(StringToUpperASCII(hash), | 113 contents_->hash_site_map.insert(std::make_pair(base::StringToUpperASCII(hash), |
114 site_id)); | 114 site_id)); |
115 } | 115 } |
116 | 116 |
117 void FilterBuilder::AddSiteList(SupervisedUserSiteList* site_list) { | 117 void FilterBuilder::AddSiteList(SupervisedUserSiteList* site_list) { |
118 std::vector<SupervisedUserSiteList::Site> sites; | 118 std::vector<SupervisedUserSiteList::Site> sites; |
119 site_list->GetSites(&sites); | 119 site_list->GetSites(&sites); |
120 int site_id = contents_->sites.size(); | 120 int site_id = contents_->sites.size(); |
121 for (std::vector<SupervisedUserSiteList::Site>::const_iterator it = | 121 for (std::vector<SupervisedUserSiteList::Site>::const_iterator it = |
122 sites.begin(); it != sites.end(); ++it) { | 122 sites.begin(); it != sites.end(); ++it) { |
123 const SupervisedUserSiteList::Site& site = *it; | 123 const SupervisedUserSiteList::Site& site = *it; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 383 |
384 void SupervisedUserURLFilter::RemoveObserver(Observer* observer) { | 384 void SupervisedUserURLFilter::RemoveObserver(Observer* observer) { |
385 observers_.RemoveObserver(observer); | 385 observers_.RemoveObserver(observer); |
386 } | 386 } |
387 | 387 |
388 void SupervisedUserURLFilter::SetContents(scoped_ptr<Contents> contents) { | 388 void SupervisedUserURLFilter::SetContents(scoped_ptr<Contents> contents) { |
389 DCHECK(CalledOnValidThread()); | 389 DCHECK(CalledOnValidThread()); |
390 contents_ = contents.Pass(); | 390 contents_ = contents.Pass(); |
391 FOR_EACH_OBSERVER(Observer, observers_, OnSiteListUpdated()); | 391 FOR_EACH_OBSERVER(Observer, observers_, OnSiteListUpdated()); |
392 } | 392 } |
OLD | NEW |