| 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" | |
| 13 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 14 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 17 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" | 16 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" |
| 18 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 17 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
| 19 #include "components/policy/core/common/cloud/cloud_policy_manager.h" | 18 #include "components/policy/core/common/cloud/cloud_policy_manager.h" |
| 20 | 19 |
| 21 namespace base { | 20 namespace base { |
| 22 class SequencedTaskRunner; | 21 class SequencedTaskRunner; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 36 class DeviceCloudPolicyStoreChromeOS; | 35 class DeviceCloudPolicyStoreChromeOS; |
| 37 class EnterpriseInstallAttributes; | 36 class EnterpriseInstallAttributes; |
| 38 | 37 |
| 39 // CloudPolicyManager specialization for device policy on Chrome OS. | 38 // CloudPolicyManager specialization for device policy on Chrome OS. |
| 40 class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager { | 39 class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager { |
| 41 public: | 40 public: |
| 42 class Observer { | 41 class Observer { |
| 43 public: | 42 public: |
| 44 // Invoked when the device cloud policy manager connects. | 43 // Invoked when the device cloud policy manager connects. |
| 45 virtual void OnDeviceCloudPolicyManagerConnected() = 0; | 44 virtual void OnDeviceCloudPolicyManagerConnected() = 0; |
| 46 // Invoked when the device cloud policy manager disconnects. | |
| 47 virtual void OnDeviceCloudPolicyManagerDisconnected() = 0; | |
| 48 }; | 45 }; |
| 49 | 46 |
| 50 using UnregisterCallback = base::Callback<void(bool)>; | |
| 51 | |
| 52 // |task_runner| is the runner for policy refresh tasks. | 47 // |task_runner| is the runner for policy refresh tasks. |
| 53 DeviceCloudPolicyManagerChromeOS( | 48 DeviceCloudPolicyManagerChromeOS( |
| 54 scoped_ptr<DeviceCloudPolicyStoreChromeOS> store, | 49 scoped_ptr<DeviceCloudPolicyStoreChromeOS> store, |
| 55 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 50 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
| 56 ServerBackedStateKeysBroker* state_keys_broker); | 51 ServerBackedStateKeysBroker* state_keys_broker); |
| 57 virtual ~DeviceCloudPolicyManagerChromeOS(); | 52 virtual ~DeviceCloudPolicyManagerChromeOS(); |
| 58 | 53 |
| 59 // Initializes state keys and requisition information. | 54 // Initializes state keys and requisition information. |
| 60 void Initialize(PrefService* local_state); | 55 void Initialize(PrefService* local_state); |
| 61 | 56 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 84 | 79 |
| 85 // Returns the robot 'email address' associated with the device robot | 80 // Returns the robot 'email address' associated with the device robot |
| 86 // account (sometimes called a service account) associated with this device | 81 // account (sometimes called a service account) associated with this device |
| 87 // during enterprise enrollment. | 82 // during enterprise enrollment. |
| 88 std::string GetRobotAccountId(); | 83 std::string GetRobotAccountId(); |
| 89 | 84 |
| 90 // Starts the connection via |client_to_connect|. | 85 // Starts the connection via |client_to_connect|. |
| 91 void StartConnection(scoped_ptr<CloudPolicyClient> client_to_connect, | 86 void StartConnection(scoped_ptr<CloudPolicyClient> client_to_connect, |
| 92 EnterpriseInstallAttributes* install_attributes); | 87 EnterpriseInstallAttributes* install_attributes); |
| 93 | 88 |
| 94 // Sends the unregister request. |callback| is invoked with a boolean | |
| 95 // parameter indicating the result when done. | |
| 96 virtual void Unregister(const UnregisterCallback& callback); | |
| 97 | |
| 98 // Disconnects the manager. | |
| 99 virtual void Disconnect(); | |
| 100 | |
| 101 DeviceCloudPolicyStoreChromeOS* device_store() { | 89 DeviceCloudPolicyStoreChromeOS* device_store() { |
| 102 return device_store_.get(); | 90 return device_store_.get(); |
| 103 } | 91 } |
| 104 | 92 |
| 105 private: | 93 private: |
| 106 // Saves the state keys received from |session_manager_client_|. | 94 // Saves the state keys received from |session_manager_client_|. |
| 107 void OnStateKeysUpdated(); | 95 void OnStateKeysUpdated(); |
| 108 | 96 |
| 109 // Initializes requisition settings at OOBE with values from VPD. | 97 // Initializes requisition settings at OOBE with values from VPD. |
| 110 void InitializeRequisition(); | 98 void InitializeRequisition(); |
| 111 | 99 |
| 112 void NotifyConnected(); | 100 void NotifyConnected(); |
| 113 void NotifyDisconnected(); | |
| 114 | 101 |
| 115 // Points to the same object as the base CloudPolicyManager::store(), but with | 102 // Points to the same object as the base CloudPolicyManager::store(), but with |
| 116 // actual device policy specific type. | 103 // actual device policy specific type. |
| 117 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_store_; | 104 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_store_; |
| 118 ServerBackedStateKeysBroker* state_keys_broker_; | 105 ServerBackedStateKeysBroker* state_keys_broker_; |
| 119 | 106 |
| 120 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; | 107 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; |
| 121 | 108 |
| 122 // PrefService instance to read the policy refresh rate from. | 109 // PrefService instance to read the policy refresh rate from. |
| 123 PrefService* local_state_; | 110 PrefService* local_state_; |
| 124 | 111 |
| 125 scoped_ptr<chromeos::attestation::AttestationPolicyObserver> | 112 scoped_ptr<chromeos::attestation::AttestationPolicyObserver> |
| 126 attestation_policy_observer_; | 113 attestation_policy_observer_; |
| 127 | 114 |
| 128 ObserverList<Observer, true> observers_; | 115 ObserverList<Observer, true> observers_; |
| 129 | 116 |
| 130 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOS); | 117 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOS); |
| 131 }; | 118 }; |
| 132 | 119 |
| 133 } // namespace policy | 120 } // namespace policy |
| 134 | 121 |
| 135 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H
_ | 122 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H
_ |
| OLD | NEW |