| 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 <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 14 #include "base/macros.h" |
| 14 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" | 17 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" |
| 18 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 18 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
| 19 #include "components/policy/core/common/cloud/cloud_policy_manager.h" | 19 #include "components/policy/core/common/cloud/cloud_policy_manager.h" |
| 20 | 20 |
| 21 namespace base { | 21 namespace base { |
| 22 class SequencedTaskRunner; | 22 class SequencedTaskRunner; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace chromeos { | 25 namespace chromeos { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 48 virtual void OnDeviceCloudPolicyManagerConnected() = 0; | 48 virtual void OnDeviceCloudPolicyManagerConnected() = 0; |
| 49 // Invoked when the device cloud policy manager disconnects. | 49 // Invoked when the device cloud policy manager disconnects. |
| 50 virtual void OnDeviceCloudPolicyManagerDisconnected() = 0; | 50 virtual void OnDeviceCloudPolicyManagerDisconnected() = 0; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 using UnregisterCallback = base::Callback<void(bool)>; | 53 using UnregisterCallback = base::Callback<void(bool)>; |
| 54 | 54 |
| 55 // |task_runner| is the runner for policy refresh, heartbeat, and status | 55 // |task_runner| is the runner for policy refresh, heartbeat, and status |
| 56 // upload tasks. | 56 // upload tasks. |
| 57 DeviceCloudPolicyManagerChromeOS( | 57 DeviceCloudPolicyManagerChromeOS( |
| 58 scoped_ptr<DeviceCloudPolicyStoreChromeOS> store, | 58 std::unique_ptr<DeviceCloudPolicyStoreChromeOS> store, |
| 59 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 59 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
| 60 ServerBackedStateKeysBroker* state_keys_broker); | 60 ServerBackedStateKeysBroker* state_keys_broker); |
| 61 ~DeviceCloudPolicyManagerChromeOS() override; | 61 ~DeviceCloudPolicyManagerChromeOS() override; |
| 62 | 62 |
| 63 // Initializes state keys and requisition information. | 63 // Initializes state keys and requisition information. |
| 64 void Initialize(PrefService* local_state); | 64 void Initialize(PrefService* local_state); |
| 65 | 65 |
| 66 void AddDeviceCloudPolicyManagerObserver(Observer* observer); | 66 void AddDeviceCloudPolicyManagerObserver(Observer* observer); |
| 67 void RemoveDeviceCloudPolicyManagerObserver(Observer* observer); | 67 void RemoveDeviceCloudPolicyManagerObserver(Observer* observer); |
| 68 | 68 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 88 | 88 |
| 89 // Returns the machine model, or an empty string if not available. | 89 // Returns the machine model, or an empty string if not available. |
| 90 static std::string GetMachineModel(); | 90 static std::string GetMachineModel(); |
| 91 | 91 |
| 92 // Returns the robot 'email address' associated with the device robot | 92 // Returns the robot 'email address' associated with the device robot |
| 93 // account (sometimes called a service account) associated with this device | 93 // account (sometimes called a service account) associated with this device |
| 94 // during enterprise enrollment. | 94 // during enterprise enrollment. |
| 95 std::string GetRobotAccountId(); | 95 std::string GetRobotAccountId(); |
| 96 | 96 |
| 97 // Starts the connection via |client_to_connect|. | 97 // Starts the connection via |client_to_connect|. |
| 98 void StartConnection(scoped_ptr<CloudPolicyClient> client_to_connect, | 98 void StartConnection(std::unique_ptr<CloudPolicyClient> client_to_connect, |
| 99 EnterpriseInstallAttributes* install_attributes); | 99 EnterpriseInstallAttributes* install_attributes); |
| 100 | 100 |
| 101 // Sends the unregister request. |callback| is invoked with a boolean | 101 // Sends the unregister request. |callback| is invoked with a boolean |
| 102 // parameter indicating the result when done. | 102 // parameter indicating the result when done. |
| 103 virtual void Unregister(const UnregisterCallback& callback); | 103 virtual void Unregister(const UnregisterCallback& callback); |
| 104 | 104 |
| 105 // Disconnects the manager. | 105 // Disconnects the manager. |
| 106 virtual void Disconnect(); | 106 virtual void Disconnect(); |
| 107 | 107 |
| 108 DeviceCloudPolicyStoreChromeOS* device_store() { | 108 DeviceCloudPolicyStoreChromeOS* device_store() { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 121 void InitializeRequisition(); | 121 void InitializeRequisition(); |
| 122 | 122 |
| 123 void NotifyConnected(); | 123 void NotifyConnected(); |
| 124 void NotifyDisconnected(); | 124 void NotifyDisconnected(); |
| 125 | 125 |
| 126 // Factory function to create the StatusUploader. | 126 // Factory function to create the StatusUploader. |
| 127 void CreateStatusUploader(); | 127 void CreateStatusUploader(); |
| 128 | 128 |
| 129 // Points to the same object as the base CloudPolicyManager::store(), but with | 129 // Points to the same object as the base CloudPolicyManager::store(), but with |
| 130 // actual device policy specific type. | 130 // actual device policy specific type. |
| 131 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_store_; | 131 std::unique_ptr<DeviceCloudPolicyStoreChromeOS> device_store_; |
| 132 ServerBackedStateKeysBroker* state_keys_broker_; | 132 ServerBackedStateKeysBroker* state_keys_broker_; |
| 133 | 133 |
| 134 // Helper object that handles updating the server with our current device | 134 // Helper object that handles updating the server with our current device |
| 135 // state. | 135 // state. |
| 136 scoped_ptr<StatusUploader> status_uploader_; | 136 std::unique_ptr<StatusUploader> status_uploader_; |
| 137 | 137 |
| 138 // Helper object that handles uploading system logs to the server. | 138 // Helper object that handles uploading system logs to the server. |
| 139 scoped_ptr<SystemLogUploader> syslog_uploader_; | 139 std::unique_ptr<SystemLogUploader> syslog_uploader_; |
| 140 | 140 |
| 141 // Helper object that handles sending heartbeats over the GCM channel to | 141 // Helper object that handles sending heartbeats over the GCM channel to |
| 142 // the server, to monitor connectivity. | 142 // the server, to monitor connectivity. |
| 143 scoped_ptr<HeartbeatScheduler> heartbeat_scheduler_; | 143 std::unique_ptr<HeartbeatScheduler> heartbeat_scheduler_; |
| 144 | 144 |
| 145 // The TaskRunner used to do device status and log uploads. | 145 // The TaskRunner used to do device status and log uploads. |
| 146 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 146 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 147 | 147 |
| 148 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; | 148 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; |
| 149 | 149 |
| 150 // PrefService instance to read the policy refresh rate from. | 150 // PrefService instance to read the policy refresh rate from. |
| 151 PrefService* local_state_; | 151 PrefService* local_state_; |
| 152 | 152 |
| 153 scoped_ptr<chromeos::attestation::AttestationPolicyObserver> | 153 std::unique_ptr<chromeos::attestation::AttestationPolicyObserver> |
| 154 attestation_policy_observer_; | 154 attestation_policy_observer_; |
| 155 | 155 |
| 156 base::ObserverList<Observer, true> observers_; | 156 base::ObserverList<Observer, true> observers_; |
| 157 | 157 |
| 158 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOS); | 158 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOS); |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 } // namespace policy | 161 } // namespace policy |
| 162 | 162 |
| 163 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H
_ | 163 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H
_ |
| OLD | NEW |