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