| Index: chrome/browser/managed_mode/managed_mode_url_filter.cc
|
| diff --git a/chrome/browser/managed_mode/managed_mode_url_filter.cc b/chrome/browser/managed_mode/managed_mode_url_filter.cc
|
| index a77e180d4b47ca9797b226bc147ddb66d0d9f0b6..8c6f38f68271ef13c636bfb90cf25f0da6fdeed9 100644
|
| --- a/chrome/browser/managed_mode/managed_mode_url_filter.cc
|
| +++ b/chrome/browser/managed_mode/managed_mode_url_filter.cc
|
| @@ -191,6 +191,14 @@ ManagedModeURLFilter::GetFilteringBehaviorForURL(const GURL& url) const {
|
| return ALLOW;
|
| #endif
|
|
|
| + // TODO(sergiu): Find a less confusing way to do this. Options include
|
| + // renaming the functions in policy::URLBlacklist or adding a function that
|
| + // checks if the URL is allowed instead of blocked.
|
| + if (!url_manual_list_allow_->IsURLBlocked(url))
|
| + return ALLOW;
|
| + if (url_manual_list_block_->IsURLBlocked(url))
|
| + return BLOCK;
|
| +
|
| // Check the list of URL patterns.
|
| std::set<URLMatcherConditionSet::ID> matching_ids =
|
| contents_->url_matcher.MatchURL(url);
|
| @@ -266,6 +274,46 @@ void ManagedModeURLFilter::SetFromPatterns(
|
| weak_ptr_factory_.GetWeakPtr(), continuation));
|
| }
|
|
|
| +void ManagedModeURLFilter::SetManualLists(scoped_ptr<ListValue> whitelist,
|
| + scoped_ptr<ListValue> blacklist){
|
| + DCHECK(CalledOnValidThread());
|
| + url_manual_list_block_.reset(new policy::URLBlacklist);
|
| + url_manual_list_allow_.reset(new policy::URLBlacklist);
|
| + url_manual_list_block_->Block(blacklist.get());
|
| + ListValue all_sites;
|
| + all_sites.Append(new base::StringValue("*"));
|
| + url_manual_list_allow_->Allow(whitelist.get());
|
| + url_manual_list_allow_->Block(&all_sites);
|
| +
|
| + // Debug
|
| + DVLOG(1) << "Loaded whitelist: ";
|
| + for (ListValue::iterator it = whitelist.get()->begin();
|
| + it != whitelist.get()->end(); ++it){
|
| + std::string item;
|
| + (*it)->GetAsString(&item);
|
| + DVLOG(1) << item;
|
| + }
|
| + DVLOG(1) << "Loaded blacklist: ";
|
| + for (ListValue::iterator it = blacklist.get()->begin();
|
| + it != blacklist.get()->end(); ++it){
|
| + std::string item;
|
| + (*it)->GetAsString(&item);
|
| + DVLOG(1) << item;
|
| + }
|
| +}
|
| +
|
| +void ManagedModeURLFilter::AddURLPatternToManualList(
|
| + const bool is_whitelist,
|
| + const std::string& url) {
|
| + DCHECK(CalledOnValidThread());
|
| + ListValue list;
|
| + list.AppendString(url);
|
| + if (is_whitelist)
|
| + url_manual_list_allow_->Allow(&list);
|
| + else
|
| + url_manual_list_block_->Block(&list);
|
| +}
|
| +
|
| void ManagedModeURLFilter::SetContents(const base::Closure& continuation,
|
| scoped_ptr<Contents> contents) {
|
| DCHECK(CalledOnValidThread());
|
|
|