Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1294)

Unified Diff: chrome/browser/supervised_user/supervised_user_url_filter.cc

Issue 537993002: Supervised users: Prototype of static client-side host blacklist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: is_sorted is Cpp11 (yay...) Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/supervised_user/supervised_user_url_filter.cc
diff --git a/chrome/browser/supervised_user/supervised_user_url_filter.cc b/chrome/browser/supervised_user/supervised_user_url_filter.cc
index b1a98f18085af44590d35631054168f44b5c75f0..23da740ecdcbc9e3b449d4592122de49e3a0c632 100644
--- a/chrome/browser/supervised_user/supervised_user_url_filter.cc
+++ b/chrome/browser/supervised_user/supervised_user_url_filter.cc
@@ -13,6 +13,7 @@
#include "base/strings/string_util.h"
#include "base/task_runner_util.h"
#include "base/threading/sequenced_worker_pool.h"
+#include "chrome/browser/supervised_user/prototype/supervised_user_blacklist.h"
#include "components/policy/core/browser/url_blacklist_manager.h"
#include "components/url_fixer/url_fixer.h"
#include "components/url_matcher/url_matcher.h"
@@ -177,7 +178,8 @@ LoadWhitelistsOnBlockingPoolThread(
SupervisedUserURLFilter::SupervisedUserURLFilter()
: default_behavior_(ALLOW),
- contents_(new Contents()) {
+ contents_(new Contents()),
+ blacklist_(NULL) {
// Detach from the current thread so we can be constructed on a different
// thread than the one where we're used.
DetachFromThread();
@@ -288,6 +290,9 @@ SupervisedUserURLFilter::GetFilteringBehaviorForURL(const GURL& url) const {
}
}
+ if (blacklist_ && blacklist_->HasURL(url))
+ return BLOCK;
+
// If the default behavior is to allow, we don't need to check anything else.
if (default_behavior_ == ALLOW)
return ALLOW;
@@ -350,6 +355,11 @@ void SupervisedUserURLFilter::LoadWhitelists(
base::Bind(&SupervisedUserURLFilter::SetContents, this));
}
+void SupervisedUserURLFilter::SetBlacklist(
+ SupervisedUserBlacklist* blacklist) {
+ blacklist_ = blacklist;
+}
+
void SupervisedUserURLFilter::SetFromPatterns(
const std::vector<std::string>& patterns) {
DCHECK(CalledOnValidThread());

Powered by Google App Engine
This is Rietveld 408576698