| Index: chrome/browser/supervised_user/supervised_user_service.h
|
| diff --git a/chrome/browser/managed_mode/managed_user_service.h b/chrome/browser/supervised_user/supervised_user_service.h
|
| similarity index 72%
|
| rename from chrome/browser/managed_mode/managed_user_service.h
|
| rename to chrome/browser/supervised_user/supervised_user_service.h
|
| index 730f02131c46698ba310a22a0acaca3e1dbffb4e..367fb970e55b17a2b9fc0a7bf021fb0e796d47b3 100644
|
| --- a/chrome/browser/managed_mode/managed_user_service.h
|
| +++ b/chrome/browser/supervised_user/supervised_user_service.h
|
| @@ -2,8 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_
|
| -#define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_
|
| +#ifndef CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_
|
| +#define CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_
|
|
|
| #include <set>
|
| #include <vector>
|
| @@ -14,8 +14,8 @@
|
| #include "base/prefs/pref_change_registrar.h"
|
| #include "base/scoped_observer.h"
|
| #include "base/strings/string16.h"
|
| -#include "chrome/browser/managed_mode/managed_mode_url_filter.h"
|
| -#include "chrome/browser/managed_mode/managed_users.h"
|
| +#include "chrome/browser/supervised_user/supervised_user_url_filter.h"
|
| +#include "chrome/browser/supervised_user/supervised_users.h"
|
| #include "chrome/browser/sync/profile_sync_service_observer.h"
|
| #include "chrome/browser/ui/browser_list_observer.h"
|
| #include "components/keyed_service/core/keyed_service.h"
|
| @@ -25,12 +25,12 @@
|
|
|
| class Browser;
|
| class GoogleServiceAuthError;
|
| -class ManagedModeURLFilter;
|
| -class ManagedModeSiteList;
|
| -class ManagedUserRegistrationUtility;
|
| -class ManagedUserSettingsService;
|
| class PermissionRequestCreator;
|
| class Profile;
|
| +class SupervisedUserRegistrationUtility;
|
| +class SupervisedUserSettingsService;
|
| +class SupervisedUserSiteList;
|
| +class SupervisedUserURLFilter;
|
|
|
| namespace extensions {
|
| class ExtensionRegistry;
|
| @@ -40,14 +40,14 @@ namespace user_prefs {
|
| class PrefRegistrySyncable;
|
| }
|
|
|
| -// This class handles all the information related to a given managed profile
|
| +// This class handles all the information related to a given supervised profile
|
| // (e.g. the installed content packs, the default URL filtering behavior, or
|
| // manual whitelist/blacklist overrides).
|
| -class ManagedUserService : public KeyedService,
|
| - public extensions::ManagementPolicy::Provider,
|
| - public ProfileSyncServiceObserver,
|
| - public extensions::ExtensionRegistryObserver,
|
| - public chrome::BrowserListObserver {
|
| +class SupervisedUserService : public KeyedService,
|
| + public extensions::ManagementPolicy::Provider,
|
| + public ProfileSyncServiceObserver,
|
| + public extensions::ExtensionRegistryObserver,
|
| + public chrome::BrowserListObserver {
|
| public:
|
| typedef std::vector<base::string16> CategoryList;
|
| typedef base::Callback<void(content::WebContents*)> NavigationBlockedCallback;
|
| @@ -63,11 +63,11 @@ class ManagedUserService : public KeyedService,
|
| public:
|
| virtual ~Delegate() {}
|
| // Returns true to indicate that the delegate handled the (de)activation, or
|
| - // false to indicate that the ManagedUserService itself should handle it.
|
| + // false to indicate that the SupervisedUserService itself should handle it.
|
| virtual bool SetActive(bool active) = 0;
|
| };
|
|
|
| - virtual ~ManagedUserService();
|
| + virtual ~SupervisedUserService();
|
|
|
| // ProfileKeyedService override:
|
| virtual void Shutdown() OVERRIDE;
|
| @@ -79,12 +79,12 @@ class ManagedUserService : public KeyedService,
|
| void SetDelegate(Delegate* delegate);
|
|
|
| // Returns the URL filter for the IO thread, for filtering network requests
|
| - // (in ManagedModeResourceThrottle).
|
| - scoped_refptr<const ManagedModeURLFilter> GetURLFilterForIOThread();
|
| + // (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.
|
| - ManagedModeURLFilter* GetURLFilterForUIThread();
|
| + SupervisedUserURLFilter* GetURLFilterForUIThread();
|
|
|
| // Returns the URL's category, obtained from the installed content packs.
|
| int GetCategory(const GURL& url);
|
| @@ -126,22 +126,23 @@ class ManagedUserService : public KeyedService,
|
| std::vector<GURL>* urls);
|
|
|
| // Initializes this object. This method does nothing if the profile is not
|
| - // managed.
|
| + // supervised.
|
| void Init();
|
|
|
| // Initializes this profile for syncing, using the provided |refresh_token| to
|
| // mint access tokens for Sync.
|
| void InitSync(const std::string& refresh_token);
|
|
|
| - // Convenience method that registers this managed user using
|
| + // Convenience method that registers this supervised user using
|
| // |registration_utility| and initializes sync with the returned token.
|
| // The |callback| will be called when registration is complete,
|
| // whether it suceeded or not -- unless registration was cancelled manually,
|
| // in which case the callback will be ignored.
|
| - void RegisterAndInitSync(ManagedUserRegistrationUtility* registration_utility,
|
| - Profile* custodian_profile,
|
| - const std::string& managed_user_id,
|
| - const AuthErrorCallback& callback);
|
| + void RegisterAndInitSync(
|
| + SupervisedUserRegistrationUtility* registration_utility,
|
| + Profile* custodian_profile,
|
| + const std::string& supervised_user_id,
|
| + const AuthErrorCallback& callback);
|
|
|
| void set_elevated_for_testing(bool skip) {
|
| elevated_for_testing_ = skip;
|
| @@ -173,56 +174,56 @@ class ManagedUserService : public KeyedService,
|
| virtual void OnBrowserSetLastActive(Browser* browser) OVERRIDE;
|
|
|
| private:
|
| - friend class ManagedUserServiceExtensionTestBase;
|
| - friend class ManagedUserServiceFactory;
|
| - FRIEND_TEST_ALL_PREFIXES(ManagedUserServiceTest, ClearOmitOnRegistration);
|
| + friend class SupervisedUserServiceExtensionTestBase;
|
| + friend class SupervisedUserServiceFactory;
|
| + FRIEND_TEST_ALL_PREFIXES(SupervisedUserServiceTest, ClearOmitOnRegistration);
|
|
|
| - // A bridge from ManagedMode (which lives on the UI thread) to the
|
| - // ManagedModeURLFilters, one of which lives on the IO thread. This class
|
| - // mediates access to them and makes sure they are kept in sync.
|
| + // 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();
|
|
|
| - ManagedModeURLFilter* ui_url_filter() const;
|
| - ManagedModeURLFilter* io_url_filter() const;
|
| + SupervisedUserURLFilter* ui_url_filter() const;
|
| + SupervisedUserURLFilter* io_url_filter() const;
|
|
|
| void SetDefaultFilteringBehavior(
|
| - ManagedModeURLFilter::FilteringBehavior behavior);
|
| - void LoadWhitelists(ScopedVector<ManagedModeSiteList> site_lists);
|
| + SupervisedUserURLFilter::FilteringBehavior behavior);
|
| + void LoadWhitelists(ScopedVector<SupervisedUserSiteList> site_lists);
|
| void SetManualHosts(scoped_ptr<std::map<std::string, bool> > host_map);
|
| void SetManualURLs(scoped_ptr<std::map<GURL, bool> > url_map);
|
|
|
| private:
|
| - // ManagedModeURLFilter is refcounted because the IO thread filter is used
|
| - // both by ProfileImplIOData and OffTheRecordProfileIOData (to filter
|
| + // 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<ManagedModeURLFilter> ui_url_filter_;
|
| - scoped_refptr<ManagedModeURLFilter> io_url_filter_;
|
| + scoped_refptr<SupervisedUserURLFilter> ui_url_filter_;
|
| + scoped_refptr<SupervisedUserURLFilter> io_url_filter_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(URLFilterContext);
|
| };
|
|
|
| - // Use |ManagedUserServiceFactory::GetForProfile(..)| to get
|
| + // Use |SupervisedUserServiceFactory::GetForProfile(..)| to get
|
| // an instance of this service.
|
| - explicit ManagedUserService(Profile* profile);
|
| + explicit SupervisedUserService(Profile* profile);
|
|
|
| void SetActive(bool active);
|
|
|
| void OnCustodianProfileDownloaded(const base::string16& full_name);
|
|
|
| - void OnManagedUserRegistered(const AuthErrorCallback& callback,
|
| - Profile* custodian_profile,
|
| - const GoogleServiceAuthError& auth_error,
|
| - const std::string& token);
|
| + void OnSupervisedUserRegistered(const AuthErrorCallback& callback,
|
| + Profile* custodian_profile,
|
| + const GoogleServiceAuthError& auth_error,
|
| + const std::string& token);
|
|
|
| void SetupSync();
|
|
|
| - bool ProfileIsManaged() const;
|
| + bool ProfileIsSupervised() const;
|
|
|
| // Internal implementation for ExtensionManagementPolicy::Delegate methods.
|
| // If |error| is not NULL, it will be filled with an error message if the
|
| @@ -231,12 +232,12 @@ class ManagedUserService : public KeyedService,
|
| base::string16* error) const;
|
|
|
| // Returns a list of all installed and enabled site lists in the current
|
| - // managed profile.
|
| - ScopedVector<ManagedModeSiteList> GetActiveSiteLists();
|
| + // supervised profile.
|
| + ScopedVector<SupervisedUserSiteList> GetActiveSiteLists();
|
|
|
| - ManagedUserSettingsService* GetSettingsService();
|
| + SupervisedUserSettingsService* GetSettingsService();
|
|
|
| - void OnManagedUserIdChanged();
|
| + void OnSupervisedUserIdChanged();
|
|
|
| void OnDefaultFilteringBehaviorChanged();
|
|
|
| @@ -283,7 +284,7 @@ class ManagedUserService : public KeyedService,
|
| // True iff we are waiting for a permission request to be issued.
|
| bool waiting_for_permissions_;
|
|
|
| - base::WeakPtrFactory<ManagedUserService> weak_ptr_factory_;
|
| + base::WeakPtrFactory<SupervisedUserService> weak_ptr_factory_;
|
| };
|
|
|
| -#endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_
|
| +#endif // CHROME_BROWSER_SUPERVISED_USER_SUPERVISED_USER_SERVICE_H_
|
|
|