| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 device_store_->RemoveObserver(this); | 103 device_store_->RemoveObserver(this); |
| 104 enrollment_handler_.reset(); | 104 enrollment_handler_.reset(); |
| 105 state_keys_update_subscription_.reset(); | 105 state_keys_update_subscription_.reset(); |
| 106 is_initialized_ = false; | 106 is_initialized_ = false; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void DeviceCloudPolicyInitializer::StartEnrollment( | 109 void DeviceCloudPolicyInitializer::StartEnrollment( |
| 110 DeviceManagementService* device_management_service, | 110 DeviceManagementService* device_management_service, |
| 111 const EnrollmentConfig& enrollment_config, | 111 const EnrollmentConfig& enrollment_config, |
| 112 const std::string& auth_token, | 112 const std::string& auth_token, |
| 113 const AllowedDeviceModes& allowed_device_modes, | |
| 114 const EnrollmentCallback& enrollment_callback) { | 113 const EnrollmentCallback& enrollment_callback) { |
| 115 DCHECK(is_initialized_); | 114 DCHECK(is_initialized_); |
| 116 DCHECK(!enrollment_handler_); | 115 DCHECK(!enrollment_handler_); |
| 117 | 116 |
| 118 manager_->core()->Disconnect(); | 117 manager_->core()->Disconnect(); |
| 119 enrollment_handler_.reset(new EnrollmentHandlerChromeOS( | 118 enrollment_handler_.reset(new EnrollmentHandlerChromeOS( |
| 120 device_store_, install_attributes_, state_keys_broker_, | 119 device_store_, install_attributes_, state_keys_broker_, |
| 121 attestation_flow_.get(), CreateClient(device_management_service), | 120 attestation_flow_.get(), CreateClient(device_management_service), |
| 122 background_task_runner_, enrollment_config, auth_token, | 121 background_task_runner_, enrollment_config, auth_token, |
| 123 install_attributes_->GetDeviceId(), manager_->GetDeviceRequisition(), | 122 install_attributes_->GetDeviceId(), manager_->GetDeviceRequisition(), |
| 124 allowed_device_modes, | |
| 125 base::Bind(&DeviceCloudPolicyInitializer::EnrollmentCompleted, | 123 base::Bind(&DeviceCloudPolicyInitializer::EnrollmentCompleted, |
| 126 base::Unretained(this), enrollment_callback))); | 124 base::Unretained(this), enrollment_callback))); |
| 127 enrollment_handler_->StartEnrollment(); | 125 enrollment_handler_->StartEnrollment(); |
| 128 } | 126 } |
| 129 | 127 |
| 130 EnrollmentConfig DeviceCloudPolicyInitializer::GetPrescribedEnrollmentConfig() | 128 EnrollmentConfig DeviceCloudPolicyInitializer::GetPrescribedEnrollmentConfig() |
| 131 const { | 129 const { |
| 132 EnrollmentConfig config; | 130 EnrollmentConfig config; |
| 133 | 131 |
| 134 // Authentication through the attestation mechanism is controlled by a | 132 // Authentication through the attestation mechanism is controlled by a |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 if (success && (success = att_signed_data.ParseFromString(signed_data))) { | 315 if (success && (success = att_signed_data.ParseFromString(signed_data))) { |
| 318 em_signed_data.set_data(att_signed_data.data()); | 316 em_signed_data.set_data(att_signed_data.data()); |
| 319 em_signed_data.set_signature(att_signed_data.signature()); | 317 em_signed_data.set_signature(att_signed_data.signature()); |
| 320 em_signed_data.set_extra_data_bytes(att_signed_data.data().size() - | 318 em_signed_data.set_extra_data_bytes(att_signed_data.data().size() - |
| 321 data.size()); | 319 data.size()); |
| 322 } | 320 } |
| 323 callback.Run(success, em_signed_data); | 321 callback.Run(success, em_signed_data); |
| 324 } | 322 } |
| 325 | 323 |
| 326 } // namespace policy | 324 } // namespace policy |
| OLD | NEW |