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_CHROMEOS_H_ | |
6 #define CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_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_client.h" | |
14 #include "chrome/browser/policy/cloud_policy_constants.h" | |
15 #include "chrome/browser/policy/cloud_policy_manager.h" | |
16 | |
17 class PrefService; | |
18 class Profile; | |
Joao da Silva
2012/11/21 17:06:34
nit: not used
Mattias Nissler (ping if slow)
2012/11/22 20:51:59
Done.
| |
19 | |
20 namespace policy { | |
21 | |
22 class DeviceManagementService; | |
23 | |
24 // UserCloudPolicyManagerChromeOS implements logic for initializing user policy | |
25 // on Chrome OS. | |
26 class UserCloudPolicyManagerChromeOS : public CloudPolicyManager, | |
27 public CloudPolicyClient::Observer { | |
28 public: | |
29 // If |wait_for_policy_fetch| is true, IsInitializationComplete() will return | |
30 // false as long as there hasn't been a successful policy fetch. | |
31 UserCloudPolicyManagerChromeOS(scoped_ptr<CloudPolicyStore> store, | |
32 bool wait_for_policy_fetch); | |
33 virtual ~UserCloudPolicyManagerChromeOS(); | |
34 | |
35 // Initializes the cloud connection. |local_state| and | |
36 // |device_management_service| must stay valid until this object is deleted. | |
37 virtual void Initialize(PrefService* local_state, | |
Joao da Silva
2012/11/21 17:06:34
Why virtual?
Mattias Nissler (ping if slow)
2012/11/22 20:51:59
No good reason. Removed.
| |
38 DeviceManagementService* device_management_service, | |
39 UserAffiliation user_affiliation); | |
40 | |
41 // Cancels waiting for the policy fetch and flags the | |
42 // ConfigurationPolicyProvider ready (assuming all other initialization tasks | |
43 // have completed). | |
44 void CancelWaitForPolicyFetch(); | |
45 | |
46 // Register the CloudPolicyClient using the passed OAuth token. | |
47 void RegisterClient(const std::string& access_token); | |
48 | |
49 // Returns true if the underlying CloudPolicyClient is already registered. | |
50 bool IsClientRegistered() const; | |
51 | |
52 // ConfigurationPolicyProvider: | |
53 virtual void Shutdown() OVERRIDE; | |
54 virtual bool IsInitializationComplete() const OVERRIDE; | |
55 | |
56 // CloudPolicyClient::Observer: | |
57 virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE; | |
58 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE; | |
59 virtual void OnClientError(CloudPolicyClient* client) OVERRIDE; | |
60 | |
61 private: | |
62 // Completion handler for the explicit policy fetch triggered on startup in | |
63 // case |wait_for_policy_fetch_| is true. | |
64 void OnInitialPolicyFetchComplete(); | |
65 | |
66 // Owns the store, note that CloudPolicyManager just keeps a plain pointer. | |
67 scoped_ptr<CloudPolicyStore> store_; | |
68 | |
69 // Whether to wait for a policy fetch to complete before reporting | |
70 // IsInitializationComplete(). | |
71 bool wait_for_policy_fetch_; | |
72 | |
73 // The pref service to pass to the refresh scheduler on initialization. | |
74 PrefService* local_state_; | |
75 | |
76 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOS); | |
77 }; | |
78 | |
79 } // namespace policy | |
80 | |
81 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_MANAGER_CHROMEOS_H_ | |
OLD | NEW |