Chromium Code Reviews| 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..1ebc3b5b96e6954f205927ad0170d82014d9ccec 100644 |
| --- a/chrome/browser/managed_mode/managed_mode_url_filter.cc |
| +++ b/chrome/browser/managed_mode/managed_mode_url_filter.cc |
| @@ -191,6 +191,12 @@ ManagedModeURLFilter::GetFilteringBehaviorForURL(const GURL& url) const { |
| return ALLOW; |
| #endif |
| + // TODO(sergiu): Find a less confusing way to do this. |
|
Pam (message me for reviews)
2013/01/07 13:00:16
Maybe add a TODO to renamethe functions in URLBlac
Sergiu
2013/01/07 16:25:05
Well since URLBlacklist is used a lot in the polic
|
| + 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 +272,50 @@ void ManagedModeURLFilter::SetFromPatterns( |
| weak_ptr_factory_.GetWeakPtr(), continuation)); |
| } |
| +void ManagedModeURLFilter::SetManualLists(scoped_ptr<ListValue> whitelist, |
| + scoped_ptr<ListValue> blacklist, |
| + const base::Closure& continuation){ |
| + DCHECK(CalledOnValidThread()); |
| + url_manual_list_block_.ClearFilters(); |
| + url_manual_list_allow_.ClearFilters(); |
| + 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 |
| + DLOG(ERROR) << "Loaded whitelist: "; |
|
Bernhard Bauer
2013/01/07 12:34:19
Debugging log statements are fine, but could you d
Sergiu
2013/01/07 16:25:05
Changed to use DVLOG(1) as recommended.
|
| + for (ListValue::iterator it = whitelist.get()->begin(); |
| + it != whitelist.get()->end(); ++it){ |
| + std::string item; |
| + (*it)->GetAsString(&item); |
| + DLOG(ERROR) << item; |
| + } |
| + LOG(ERROR) << "Loaded blacklist: "; |
|
Pam (message me for reviews)
2013/01/07 13:00:16
...or users' consoles. (see Bernhard's comment)
Sergiu
2013/01/07 16:25:05
Done.
|
| + for (ListValue::iterator it = blacklist.get()->begin(); |
| + it != blacklist.get()->end(); ++it){ |
| + std::string item; |
| + (*it)->GetAsString(&item); |
| + DLOG(ERROR) << item; |
| + } |
| + |
| + continuation.Run(); |
| +} |
| + |
| +void ManagedModeURLFilter::AddURLPatternToManualList( |
| + const bool isWhitelist, |
| + const std::string& url, |
| + const base::Closure& continuation) { |
|
Pam (message me for reviews)
2013/01/07 13:00:16
Not used?
Sergiu
2013/01/07 16:25:05
Removed.
|
| + DCHECK(CalledOnValidThread()); |
| + ListValue list; |
| + list.AppendString(url); |
| + if (isWhitelist) |
| + 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()); |