Chromium Code Reviews| Index: chrome/browser/policy/user_cloud_policy_manager.h |
| diff --git a/chrome/browser/policy/user_cloud_policy_manager.h b/chrome/browser/policy/user_cloud_policy_manager.h |
| index 2129bb65c2ca91645fcc292ec4f0af092e062287..696e5865bede2f2bed360ffaa8fb604db66b51b4 100644 |
| --- a/chrome/browser/policy/user_cloud_policy_manager.h |
| +++ b/chrome/browser/policy/user_cloud_policy_manager.h |
| @@ -20,52 +20,22 @@ class Profile; |
| namespace policy { |
| class DeviceManagementService; |
| +class UserCloudPolicyStore; |
| -// UserCloudPolicyManager keeps track of all things user policy, drives the |
| -// corresponding cloud policy service and publishes policy through the |
| -// ConfigurationPolicyProvider interface. |
| -class UserCloudPolicyManager : public CloudPolicyManager, |
| - public CloudPolicyClient::Observer { |
| +// UserCloudPolicyManager handles initialization of user policy for Chrome |
| +// Profiles on the desktop platforms. |
|
Andrew T Wilson (Slow)
2012/11/21 17:34:24
Careful about saying "desktop platforms" as we wil
Mattias Nissler (ping if slow)
2012/11/22 20:51:59
For now, it's correct. It's unclear at this point
|
| +class UserCloudPolicyManager : public CloudPolicyManager { |
| public: |
| // If |wait_for_policy_fetch| is true, IsInitializationComplete() will return |
| // false as long as there hasn't been a successful policy fetch. |
|
Joao da Silva
2012/11/21 17:06:34
Update comment.
This is dropping support to wait
Andrew T Wilson (Slow)
2012/11/21 17:34:24
BTW, I'm fine with that for now. We might need to
Mattias Nissler (ping if slow)
2012/11/22 20:51:59
Done.
Mattias Nissler (ping if slow)
2012/11/22 20:51:59
Once we need it on desktop too, we can see what th
|
| - UserCloudPolicyManager(scoped_ptr<CloudPolicyStore> store, |
| - bool wait_for_policy_fetch); |
| + explicit UserCloudPolicyManager(scoped_ptr<UserCloudPolicyStore> store); |
| virtual ~UserCloudPolicyManager(); |
| - // Enumeration describing how to initialize the UserCloudPolicyManager. |
| - enum PolicyInit { |
| - // Forces policy to be loaded immediately (as part of the constructor). This |
| - // will block the caller while file I/O happens, and the resulting object |
| - // will start in an initialized state. This is only supported on desktop |
| - // platforms, as those platforms are the only ones that initialize Profile |
| - // objects synchronously (on ChromeOS, Profiles are initialized |
| - // asynchronously, and the underlying policy mechanism is also |
| - // asynchronous). |
| - POLICY_INIT_IMMEDIATELY, |
| - |
| - // Loads policy via a background task. UserCloudPolicyManager will mark |
| - // itself as initialized once the policy has finished loading. |
| - POLICY_INIT_IN_BACKGROUND, |
| - |
| - // Attempts to download the latest policy from the server, and if the |
| - // request fails, just uses the existing cached policy. The object will |
| - // mark itself as initialized once the request is complete. |
| - POLICY_INIT_REFRESH_FROM_SERVER |
| - }; |
| - |
| - // Creates a UserCloudPolicyManager instance associated with the passed |
| - // |profile|. If |policy_init| is passed as POLICY_INIT_IMMEDIATELY, then |
| - // the CloudPolicyStore will be fully initialized before this call returns. |
| - static scoped_ptr<UserCloudPolicyManager> Create(Profile* profile, |
| - PolicyInit policy_init); |
| - |
| - // Initializes the cloud connection. |local_state| and |service| must stay |
| - // valid until this object is deleted or ShutdownAndRemovePolicy() gets |
| - // called. Virtual for mocking. |
| + // Initializes the cloud connection. |local_state| and |
| + // |device_management_service| must stay valid until this object is deleted or |
| + // ShutdownAndRemovePolicy() gets called. Virtual for mocking. |
| virtual void Initialize(PrefService* local_state, |
| - DeviceManagementService* device_management_service, |
| - UserAffiliation user_affiliation); |
| + DeviceManagementService* device_management_service); |
| // Shuts down the UserCloudPolicyManager (removes and stops refreshing the |
| // cached cloud policy). This is typically called when a profile is being |
| @@ -73,11 +43,6 @@ class UserCloudPolicyManager : public CloudPolicyManager, |
| // provided by this object until the next time Initialize() is invoked. |
| void ShutdownAndRemovePolicy(); |
| - // Cancels waiting for the policy fetch and flags the |
| - // ConfigurationPolicyProvider ready (assuming all other initialization tasks |
| - // have completed). |
| - void CancelWaitForPolicyFetch(); |
| - |
| // Returns true if the underlying CloudPolicyClient is already registered. |
| // Virtual for mocking. |
| virtual bool IsClientRegistered() const; |
| @@ -85,26 +50,10 @@ class UserCloudPolicyManager : public CloudPolicyManager, |
| // Register the CloudPolicyClient using the passed OAuth token. |
| void RegisterClient(const std::string& access_token); |
| - // ConfigurationPolicyProvider: |
| - virtual void Shutdown() OVERRIDE; |
| - virtual bool IsInitializationComplete() const OVERRIDE; |
| - |
| - // CloudPolicyClient::Observer: |
| - virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE; |
| - virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE; |
| - virtual void OnClientError(CloudPolicyClient* client) OVERRIDE; |
| - |
| private: |
| - // Completion handler for the explicit policy fetch triggered on startup in |
| - // case |wait_for_policy_fetch_| is true. |
| - void OnInitialPolicyFetchComplete(); |
| - |
| - // Whether to wait for a policy fetch to complete before reporting |
| - // IsInitializationComplete(). |
| - bool wait_for_policy_fetch_; |
| - |
| - // The pref service to pass to the refresh scheduler on initialization. |
| - PrefService* local_state_; |
| + // Typed pointer to the store owned by UserCloudPolicyManager. Note that |
| + // CloudPolicyManager only keeps a plain CloudPolicyStore pointer. |
| + scoped_ptr<UserCloudPolicyStore> store_; |
| DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManager); |
| }; |