| 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_ENROLLMENT_HANDLER_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" | 15 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" |
| 16 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" | 16 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" |
| 17 #include "chrome/browser/chromeos/policy/enrollment_config.h" | 17 #include "chrome/browser/chromeos/policy/enrollment_config.h" |
| 18 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 18 #include "chrome/browser/chromeos/settings/install_attributes.h" |
| 19 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 19 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
| 20 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 20 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| 21 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 21 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
| 22 #include "components/policy/proto/device_management_backend.pb.h" | 22 #include "components/policy/proto/device_management_backend.pb.h" |
| 23 #include "google_apis/gaia/gaia_oauth_client.h" | 23 #include "google_apis/gaia/gaia_oauth_client.h" |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 class SequencedTaskRunner; | 26 class SequencedTaskRunner; |
| 27 } | 27 } |
| 28 | 28 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 52 public CloudPolicyStore::Observer, | 52 public CloudPolicyStore::Observer, |
| 53 public gaia::GaiaOAuthClient::Delegate { | 53 public gaia::GaiaOAuthClient::Delegate { |
| 54 public: | 54 public: |
| 55 typedef DeviceCloudPolicyInitializer::EnrollmentCallback | 55 typedef DeviceCloudPolicyInitializer::EnrollmentCallback |
| 56 EnrollmentCallback; | 56 EnrollmentCallback; |
| 57 | 57 |
| 58 // |store| and |install_attributes| must remain valid for the life time of the | 58 // |store| and |install_attributes| must remain valid for the life time of the |
| 59 // enrollment handler. | 59 // enrollment handler. |
| 60 EnrollmentHandlerChromeOS( | 60 EnrollmentHandlerChromeOS( |
| 61 DeviceCloudPolicyStoreChromeOS* store, | 61 DeviceCloudPolicyStoreChromeOS* store, |
| 62 EnterpriseInstallAttributes* install_attributes, | 62 chromeos::InstallAttributes* install_attributes, |
| 63 ServerBackedStateKeysBroker* state_keys_broker, | 63 ServerBackedStateKeysBroker* state_keys_broker, |
| 64 chromeos::attestation::AttestationFlow* attestation_flow, | 64 chromeos::attestation::AttestationFlow* attestation_flow, |
| 65 std::unique_ptr<CloudPolicyClient> client, | 65 std::unique_ptr<CloudPolicyClient> client, |
| 66 scoped_refptr<base::SequencedTaskRunner> background_task_runner, | 66 scoped_refptr<base::SequencedTaskRunner> background_task_runner, |
| 67 const EnrollmentConfig& enrollment_config, | 67 const EnrollmentConfig& enrollment_config, |
| 68 const std::string& auth_token, | 68 const std::string& auth_token, |
| 69 const std::string& client_id, | 69 const std::string& client_id, |
| 70 const std::string& requisition, | 70 const std::string& requisition, |
| 71 const EnrollmentCallback& completion_callback); | 71 const EnrollmentCallback& completion_callback); |
| 72 ~EnrollmentHandlerChromeOS() override; | 72 ~EnrollmentHandlerChromeOS() override; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // DeviceSettingsService::SetManagementSettings() for consumer | 138 // DeviceSettingsService::SetManagementSettings() for consumer |
| 139 // enrollment. | 139 // enrollment. |
| 140 void StartLockDevice(); | 140 void StartLockDevice(); |
| 141 | 141 |
| 142 // Called after SetManagementSettings() is done. Proceeds to robot | 142 // Called after SetManagementSettings() is done. Proceeds to robot |
| 143 // auth code storing if successful. | 143 // auth code storing if successful. |
| 144 void HandleSetManagementSettingsDone(bool success); | 144 void HandleSetManagementSettingsDone(bool success); |
| 145 | 145 |
| 146 // Handle callback from InstallAttributes::LockDevice() and retry on failure. | 146 // Handle callback from InstallAttributes::LockDevice() and retry on failure. |
| 147 void HandleLockDeviceResult( | 147 void HandleLockDeviceResult( |
| 148 EnterpriseInstallAttributes::LockResult lock_result); | 148 chromeos::InstallAttributes::LockResult lock_result); |
| 149 | 149 |
| 150 // Initiates storing of robot auth token. | 150 // Initiates storing of robot auth token. |
| 151 void StartStoreRobotAuth(); | 151 void StartStoreRobotAuth(); |
| 152 | 152 |
| 153 // Handles completion of the robot token store operation. | 153 // Handles completion of the robot token store operation. |
| 154 void HandleStoreRobotAuthTokenResult(bool result); | 154 void HandleStoreRobotAuthTokenResult(bool result); |
| 155 | 155 |
| 156 // Drops any ongoing actions. | 156 // Drops any ongoing actions. |
| 157 void Stop(); | 157 void Stop(); |
| 158 | 158 |
| 159 // Reports the result of the enrollment process to the initiator. | 159 // Reports the result of the enrollment process to the initiator. |
| 160 void ReportResult(EnrollmentStatus status); | 160 void ReportResult(EnrollmentStatus status); |
| 161 | 161 |
| 162 DeviceCloudPolicyStoreChromeOS* store_; | 162 DeviceCloudPolicyStoreChromeOS* store_; |
| 163 EnterpriseInstallAttributes* install_attributes_; | 163 chromeos::InstallAttributes* install_attributes_; |
| 164 ServerBackedStateKeysBroker* state_keys_broker_; | 164 ServerBackedStateKeysBroker* state_keys_broker_; |
| 165 chromeos::attestation::AttestationFlow* attestation_flow_; | 165 chromeos::attestation::AttestationFlow* attestation_flow_; |
| 166 std::unique_ptr<CloudPolicyClient> client_; | 166 std::unique_ptr<CloudPolicyClient> client_; |
| 167 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; | 167 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; |
| 168 std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; | 168 std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
| 169 | 169 |
| 170 EnrollmentConfig enrollment_config_; | 170 EnrollmentConfig enrollment_config_; |
| 171 std::string auth_token_; | 171 std::string auth_token_; |
| 172 std::string client_id_; | 172 std::string client_id_; |
| 173 std::string requisition_; | 173 std::string requisition_; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 199 int lockbox_init_duration_; | 199 int lockbox_init_duration_; |
| 200 | 200 |
| 201 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; | 201 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; |
| 202 | 202 |
| 203 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); | 203 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 } // namespace policy | 206 } // namespace policy |
| 207 | 207 |
| 208 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ | 208 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ |
| OLD | NEW |