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

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

Issue 2578533002: Reland of Supervised Users: Create ResourceThrottle only if filtering is enabled (Closed)
Patch Set: rebase Created 3 years, 11 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.h
diff --git a/chrome/browser/supervised_user/supervised_user_url_filter.h b/chrome/browser/supervised_user/supervised_user_url_filter.h
index 0b34d37f47912678b09440bfab1f78c60623197f..e11c50cc6159d9a3379319d7db2e1365ae53590d 100644
--- a/chrome/browser/supervised_user/supervised_user_url_filter.h
+++ b/chrome/browser/supervised_user/supervised_user_url_filter.h
@@ -61,7 +61,11 @@ class SupervisedUserURLFilter
class Observer {
public:
+ // Called whenever the filter changes.
+ // TODO(treib,bauerb): Rename to OnURLFilterUpdated.
virtual void OnSiteListUpdated() = 0;
+ // Called whenever a check started via
+ // GetFilteringBehaviorForURLWithAsyncChecks completes.
virtual void OnURLChecked(
const GURL& url,
FilteringBehavior behavior,
@@ -106,6 +110,13 @@ class SupervisedUserURLFilter
static bool HostMatchesPattern(const std::string& canonical_host,
const std::string& pattern);
+ // Returns whether the filter is enabled. If this is false, all URL checks
+ // will return ALLOW.
+ bool enabled() const { return enabled_; }
+
+ // Enables or disables the filter. Notifies observers if the state changed.
+ void SetEnabled(bool enabled);
+
// Returns the filtering behavior for a given URL, based on the default
// behavior and whether it is on a site list.
FilteringBehavior GetFilteringBehaviorForURL(const GURL& url) const;
@@ -198,6 +209,10 @@ class SupervisedUserURLFilter
// This is mutable to allow notification in const member functions.
mutable base::ObserverList<Observer> observers_;
+ // Whether this filter is enabled. True for supervised user profiles, false
+ // otherwise.
+ bool enabled_;
+
FilteringBehavior default_behavior_;
std::unique_ptr<Contents> contents_;

Powered by Google App Engine
This is Rietveld 408576698