Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback_forward.h" | |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 16 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" | 17 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" |
| 17 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 18 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
| 18 #include "components/policy/core/common/cloud/cloud_policy_manager.h" | 19 #include "components/policy/core/common/cloud/cloud_policy_manager.h" |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 class SequencedTaskRunner; | 22 class SequencedTaskRunner; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 34 | 35 |
| 35 class DeviceCloudPolicyStoreChromeOS; | 36 class DeviceCloudPolicyStoreChromeOS; |
| 36 | 37 |
| 37 // CloudPolicyManager specialization for device policy on Chrome OS. | 38 // CloudPolicyManager specialization for device policy on Chrome OS. |
| 38 class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager { | 39 class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager { |
| 39 public: | 40 public: |
| 40 class Observer { | 41 class Observer { |
| 41 public: | 42 public: |
| 42 // Invoked when the device cloud policy manager connects. | 43 // Invoked when the device cloud policy manager connects. |
| 43 virtual void OnDeviceCloudPolicyManagerConnected() = 0; | 44 virtual void OnDeviceCloudPolicyManagerConnected() = 0; |
| 45 // Invoked when the device cloud policy manager is disconnected. | |
|
bartfab (slow)
2014/11/28 13:25:18
Nit: s/is disconnected/disconnects/
davidyu
2014/12/01 17:05:22
Done.
| |
| 46 virtual void OnDeviceCloudPolicyManagerDisconnected() = 0; | |
| 44 }; | 47 }; |
| 45 | 48 |
| 46 // |task_runner| is the runner for policy refresh tasks. | 49 // |task_runner| is the runner for policy refresh tasks. |
| 47 DeviceCloudPolicyManagerChromeOS( | 50 DeviceCloudPolicyManagerChromeOS( |
| 48 scoped_ptr<DeviceCloudPolicyStoreChromeOS> store, | 51 scoped_ptr<DeviceCloudPolicyStoreChromeOS> store, |
| 49 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 52 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
| 50 ServerBackedStateKeysBroker* state_keys_broker); | 53 ServerBackedStateKeysBroker* state_keys_broker); |
| 51 virtual ~DeviceCloudPolicyManagerChromeOS(); | 54 virtual ~DeviceCloudPolicyManagerChromeOS(); |
| 52 | 55 |
| 53 // Initializes state keys and requisition information. | 56 // Initializes state keys and requisition information. |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 79 // Returns the robot 'email address' associated with the device robot | 82 // Returns the robot 'email address' associated with the device robot |
| 80 // account (sometimes called a service account) associated with this device | 83 // account (sometimes called a service account) associated with this device |
| 81 // during enterprise enrollment. | 84 // during enterprise enrollment. |
| 82 std::string GetRobotAccountId(); | 85 std::string GetRobotAccountId(); |
| 83 | 86 |
| 84 // Starts the connection via |client_to_connect|. | 87 // Starts the connection via |client_to_connect|. |
| 85 void StartConnection(scoped_ptr<CloudPolicyClient> client_to_connect, | 88 void StartConnection(scoped_ptr<CloudPolicyClient> client_to_connect, |
| 86 scoped_ptr<CloudPolicyClient::StatusProvider> | 89 scoped_ptr<CloudPolicyClient::StatusProvider> |
| 87 device_status_provider); | 90 device_status_provider); |
| 88 | 91 |
| 92 // Sends the unregister request. |callback| is invoked with a boolean | |
| 93 // parameter indicating the result when done. | |
| 94 virtual void Unregister(const base::Callback<void(bool)>& callback); | |
|
bartfab (slow)
2014/11/28 13:25:18
Nit: If you define a type for this callback, the f
davidyu
2014/12/01 17:05:22
Done.
| |
| 95 | |
| 96 // Disconnects the manager. | |
| 97 virtual void Disconnect(); | |
| 98 | |
| 89 DeviceCloudPolicyStoreChromeOS* device_store() { | 99 DeviceCloudPolicyStoreChromeOS* device_store() { |
| 90 return device_store_.get(); | 100 return device_store_.get(); |
| 91 } | 101 } |
| 92 | 102 |
| 93 private: | 103 private: |
| 94 // Saves the state keys received from |session_manager_client_|. | 104 // Saves the state keys received from |session_manager_client_|. |
| 95 void OnStateKeysUpdated(); | 105 void OnStateKeysUpdated(); |
| 96 | 106 |
| 97 // Initializes requisition settings at OOBE with values from VPD. | 107 // Initializes requisition settings at OOBE with values from VPD. |
| 98 void InitializeRequisition(); | 108 void InitializeRequisition(); |
| 99 | 109 |
| 100 void NotifyConnected(); | 110 void NotifyConnected(); |
| 111 void NotifyDisconnected(); | |
| 101 | 112 |
| 102 // Points to the same object as the base CloudPolicyManager::store(), but with | 113 // Points to the same object as the base CloudPolicyManager::store(), but with |
| 103 // actual device policy specific type. | 114 // actual device policy specific type. |
| 104 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_store_; | 115 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_store_; |
| 105 ServerBackedStateKeysBroker* state_keys_broker_; | 116 ServerBackedStateKeysBroker* state_keys_broker_; |
| 106 | 117 |
| 107 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; | 118 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; |
| 108 | 119 |
| 109 // PrefService instance to read the policy refresh rate from. | 120 // PrefService instance to read the policy refresh rate from. |
| 110 PrefService* local_state_; | 121 PrefService* local_state_; |
| 111 | 122 |
| 112 scoped_ptr<chromeos::attestation::AttestationPolicyObserver> | 123 scoped_ptr<chromeos::attestation::AttestationPolicyObserver> |
| 113 attestation_policy_observer_; | 124 attestation_policy_observer_; |
| 114 | 125 |
| 115 // TODO(davidyu): Currently we need to keep this object alive while | 126 // TODO(davidyu): Currently we need to keep this object alive while |
| 116 // CloudPolicyClient is in use. We should have CPC take over the | 127 // CloudPolicyClient is in use. We should have CPC take over the |
| 117 // ownership of this object instead. See http://crbug.com/383696. | 128 // ownership of this object instead. See http://crbug.com/383696. |
| 118 scoped_ptr<CloudPolicyClient::StatusProvider> device_status_provider_; | 129 scoped_ptr<CloudPolicyClient::StatusProvider> device_status_provider_; |
| 119 | 130 |
| 120 ObserverList<Observer, true> observers_; | 131 ObserverList<Observer, true> observers_; |
| 121 | 132 |
| 122 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOS); | 133 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOS); |
| 123 }; | 134 }; |
| 124 | 135 |
| 125 } // namespace policy | 136 } // namespace policy |
| 126 | 137 |
| 127 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H _ | 138 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H _ |
| OLD | NEW |