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 6abf8d8b4c8bdae07201d5deaeecb32477d05539..25dc511492bf3e2b59249db10d875759bc5e0181 100644 |
--- a/chrome/browser/managed_mode/managed_mode_url_filter.cc |
+++ b/chrome/browser/managed_mode/managed_mode_url_filter.cc |
@@ -160,6 +160,12 @@ ManagedModeURLFilter::GetFilteringBehaviorForURL(const GURL& url) const { |
return ALLOW; |
#endif |
+ if (!url_manual_list_allow_.IsURLBlocked(url)) { |
Bernhard Bauer
2012/11/16 15:04:46
Urgh, this is hella confusing. For a demo it's fin
Sergiu
2012/11/26 14:48:08
Added a TODO in the meanwhile.
|
+ if (url_manual_list_block_.IsURLBlocked(url)) |
+ return BLOCK; |
+ return ALLOW; |
+ } |
+ |
std::set<URLMatcherConditionSet::ID> matching_ids = |
contents_->url_matcher.MatchURL(url); |
return matching_ids.empty() ? behavior_ : ALLOW; |
@@ -214,6 +220,53 @@ void ManagedModeURLFilter::SetWhitelist( |
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_.Block(blacklist.get()); |
+ ListValue all_sites; |
+ all_sites.Append(new base::StringValue("*")); |
+ // XXX should do BlockingPool stuff here as well? |
Bernhard Bauer
2012/11/16 15:04:46
That depends ;-) You have an asynchronous interfac
Sergiu
2012/11/26 14:48:08
The question refers more to whether it is needed/d
|
+ url_manual_list_allow_.Allow(whitelist.get()); |
+ url_manual_list_allow_.Block(&all_sites); |
+ |
+ // Debug |
+ DLOG(ERROR) << "Loaded whitelist: "; |
+ 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: "; |
+ 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::AddStringToManualBlacklist(const std::string& url, |
+ const base::Closure& continuation) { |
+ DCHECK(CalledOnValidThread()); |
+ ListValue bl; |
Bernhard Bauer
2012/11/16 15:04:46
Please don't use abbreviations for variable names.
Sergiu
2012/11/26 14:48:08
Done.
|
+ bl.AppendString(url); |
+ url_manual_list_block_.Block(&bl); |
+} |
+ |
+void ManagedModeURLFilter::AddStringToManualWhitelist(const std::string& url, |
+ const base::Closure& continuation) { |
+ DCHECK(CalledOnValidThread()); |
+ |
+ ListValue bl; |
+ bl.AppendString(url); |
+ url_manual_list_allow_.Allow(&bl); |
+} |
+ |
void ManagedModeURLFilter::SetContents(const base::Closure& continuation, |
scoped_ptr<Contents> contents) { |
DCHECK(CalledOnValidThread()); |