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

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

Issue 2776493005: Convert SupervisedUserResourceThrottle to a NavigationThrottle. (Closed)
Patch Set: Response to comments Created 3 years, 9 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_service.h
diff --git a/chrome/browser/supervised_user/supervised_user_service.h b/chrome/browser/supervised_user/supervised_user_service.h
index ef91ae9ecc333b825bfa4da05575ff5013ddd755..341b81c79166016fe03c6eff0d6e4cf8b5430cad 100644
--- a/chrome/browser/supervised_user/supervised_user_service.h
+++ b/chrome/browser/supervised_user/supervised_user_service.h
@@ -106,13 +106,10 @@ class SupervisedUserService : public KeyedService,
void SetDelegate(Delegate* delegate);
- // Returns the URL filter for the IO thread, for filtering network requests
- // (in SupervisedUserResourceThrottle).
- scoped_refptr<const SupervisedUserURLFilter> GetURLFilterForIOThread();
-
- // Returns the URL filter for the UI thread, for filtering navigations and
- // classifying sites in the history view.
- SupervisedUserURLFilter* GetURLFilterForUIThread();
+ // Returns the URL filter for filtering navigations and classifying sites in
+ // the history view. Both this method and the returned filter may only be used
+ // on the UI thread.
+ SupervisedUserURLFilter* GetURLFilter();
// Returns the whitelist service.
SupervisedUserWhitelistService* GetWhitelistService();
@@ -239,50 +236,6 @@ class SupervisedUserService : public KeyedService,
using CreatePermissionRequestCallback =
base::Callback<void(PermissionRequestCreator*, const SuccessCallback&)>;
- // A bridge from the UI thread to the SupervisedUserURLFilters, one of which
- // lives on the IO thread. This class mediates access to them and makes sure
- // they are kept in sync.
- class URLFilterContext {
- public:
- URLFilterContext();
- ~URLFilterContext();
-
- SupervisedUserURLFilter* ui_url_filter() const;
- SupervisedUserURLFilter* io_url_filter() const;
-
- void SetDefaultFilteringBehavior(
- SupervisedUserURLFilter::FilteringBehavior behavior);
- void LoadWhitelists(
- const std::vector<scoped_refptr<SupervisedUserSiteList>>& site_lists);
- // TODO(treib): Make SupervisedUserBlacklist refcounted, so the IO thread
- // will retain a reference to the blacklist.
- void SetBlacklist(const SupervisedUserBlacklist* blacklist);
- bool HasBlacklist() const;
- void SetManualHosts(std::unique_ptr<std::map<std::string, bool>> host_map);
- void SetManualURLs(std::unique_ptr<std::map<GURL, bool>> url_map);
-
- void InitAsyncURLChecker(
- const scoped_refptr<net::URLRequestContextGetter>& context);
- bool HasAsyncURLChecker() const;
- void ClearAsyncURLChecker();
-
- void Clear();
-
- private:
- void OnBlacklistLoaded(const base::Closure& callback);
-
- // SupervisedUserURLFilter is refcounted because the IO thread filter is
- // used both by ProfileImplIOData and OffTheRecordProfileIOData (to filter
- // network requests), so they both keep a reference to it.
- // Clients should not keep references to the UI thread filter, however
- // (the filter will live as long as the profile lives, and afterwards it
- // should not be used anymore either).
- scoped_refptr<SupervisedUserURLFilter> ui_url_filter_;
- scoped_refptr<SupervisedUserURLFilter> io_url_filter_;
-
- DISALLOW_COPY_AND_ASSIGN(URLFilterContext);
- };
-
// Use |SupervisedUserServiceFactory::GetForProfile(..)| to get
// an instance of this service.
explicit SupervisedUserService(Profile* profile);
@@ -438,7 +391,7 @@ class SupervisedUserService : public KeyedService,
// True only when |Shutdown()| method has been called.
bool did_shutdown_;
- URLFilterContext url_filter_context_;
+ SupervisedUserURLFilter url_filter_;
// Stores a map from extension_id -> approved version by the custodian.
// It is only relevant for SU-initiated installs.

Powered by Google App Engine
This is Rietveld 408576698