| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_MANAGER_H_ | |
| 6 #define CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_MANAGER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "chrome/browser/policy/cloud_policy_manager.h" | |
| 14 | |
| 15 class PrefService; | |
| 16 class Profile; | |
| 17 | |
| 18 namespace policy { | |
| 19 | |
| 20 class DeviceManagementService; | |
| 21 class UserCloudPolicyStore; | |
| 22 | |
| 23 // UserCloudPolicyManager handles initialization of user policy for Chrome | |
| 24 // Profiles on the desktop platforms. | |
| 25 class UserCloudPolicyManager : public CloudPolicyManager { | |
| 26 public: | |
| 27 UserCloudPolicyManager(Profile* profile, | |
| 28 scoped_ptr<UserCloudPolicyStore> store); | |
| 29 virtual ~UserCloudPolicyManager(); | |
| 30 | |
| 31 // Initializes the cloud connection. |local_state| and | |
| 32 // |device_management_service| must stay valid until this object is deleted or | |
| 33 // DisconnectAndRemovePolicy() gets called. Virtual for mocking. | |
| 34 virtual void Connect(PrefService* local_state, | |
| 35 DeviceManagementService* device_management_service); | |
| 36 | |
| 37 // Shuts down the UserCloudPolicyManager (removes and stops refreshing the | |
| 38 // cached cloud policy). This is typically called when a profile is being | |
| 39 // disassociated from a given user (e.g. during signout). No policy will be | |
| 40 // provided by this object until the next time Initialize() is invoked. | |
| 41 void DisconnectAndRemovePolicy(); | |
| 42 | |
| 43 // Returns true if the underlying CloudPolicyClient is already registered. | |
| 44 // Virtual for mocking. | |
| 45 virtual bool IsClientRegistered() const; | |
| 46 | |
| 47 // Register the CloudPolicyClient using the passed OAuth token. | |
| 48 void RegisterClient(const std::string& access_token); | |
| 49 | |
| 50 private: | |
| 51 // The profile this instance belongs to. | |
| 52 Profile* profile_; | |
| 53 | |
| 54 // Typed pointer to the store owned by UserCloudPolicyManager. Note that | |
| 55 // CloudPolicyManager only keeps a plain CloudPolicyStore pointer. | |
| 56 scoped_ptr<UserCloudPolicyStore> store_; | |
| 57 | |
| 58 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManager); | |
| 59 }; | |
| 60 | |
| 61 } // namespace policy | |
| 62 | |
| 63 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_MANAGER_H_ | |
| OLD | NEW |