Chromium Code Reviews| 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" |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/command_line.h" | |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 13 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 14 #include "base/sequenced_task_runner.h" | 15 #include "base/sequenced_task_runner.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h" | 18 #include "chrome/browser/chromeos/attestation/attestation_ca_client.h" |
| 18 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 19 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
| 19 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" | 20 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" |
| 20 #include "chrome/browser/chromeos/policy/device_status_collector.h" | 21 #include "chrome/browser/chromeos/policy/device_status_collector.h" |
| 21 #include "chrome/browser/chromeos/policy/enrollment_config.h" | 22 #include "chrome/browser/chromeos/policy/enrollment_config.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 93 | 94 |
| 94 void DeviceCloudPolicyInitializer::StartEnrollment( | 95 void DeviceCloudPolicyInitializer::StartEnrollment( |
| 95 DeviceManagementService* device_management_service, | 96 DeviceManagementService* device_management_service, |
| 96 const EnrollmentConfig& enrollment_config, | 97 const EnrollmentConfig& enrollment_config, |
| 97 const std::string& auth_token, | 98 const std::string& auth_token, |
| 98 const EnrollmentCallback& enrollment_callback) { | 99 const EnrollmentCallback& enrollment_callback) { |
| 99 DCHECK(is_initialized_); | 100 DCHECK(is_initialized_); |
| 100 DCHECK(!enrollment_handler_); | 101 DCHECK(!enrollment_handler_); |
| 101 | 102 |
| 102 manager_->core()->Disconnect(); | 103 manager_->core()->Disconnect(); |
| 103 // TODO(rsorokin): make proper SetDeviceRequisition | 104 // TODO(rsorokin): Remove that once DM server does not require requisition. |
|
achuithb
2017/02/07 20:27:16
Is there a tracking bug?
Roman Sorokin (ftl)
2017/02/10 14:57:10
Done.
| |
| 104 if (!enrollment_config.management_realm.empty()) | 105 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 106 chromeos::switches::kEnableAd)) { | |
| 105 manager_->SetDeviceRequisition("chrome_ad"); | 107 manager_->SetDeviceRequisition("chrome_ad"); |
| 108 } | |
| 106 | 109 |
| 107 enrollment_handler_.reset(new EnrollmentHandlerChromeOS( | 110 enrollment_handler_.reset(new EnrollmentHandlerChromeOS( |
| 108 device_store_, install_attributes_, state_keys_broker_, | 111 device_store_, install_attributes_, state_keys_broker_, |
| 109 attestation_flow_.get(), CreateClient(device_management_service), | 112 attestation_flow_.get(), CreateClient(device_management_service), |
| 110 background_task_runner_, enrollment_config, auth_token, | 113 background_task_runner_, enrollment_config, auth_token, |
| 111 install_attributes_->GetDeviceId(), manager_->GetDeviceRequisition(), | 114 install_attributes_->GetDeviceId(), manager_->GetDeviceRequisition(), |
| 112 base::Bind(&DeviceCloudPolicyInitializer::EnrollmentCompleted, | 115 base::Bind(&DeviceCloudPolicyInitializer::EnrollmentCompleted, |
| 113 base::Unretained(this), enrollment_callback))); | 116 base::Unretained(this), enrollment_callback))); |
| 114 enrollment_handler_->StartEnrollment(); | 117 enrollment_handler_->StartEnrollment(); |
| 115 } | 118 } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 if (success && (success = att_signed_data.ParseFromString(signed_data))) { | 332 if (success && (success = att_signed_data.ParseFromString(signed_data))) { |
| 330 em_signed_data.set_data(att_signed_data.data()); | 333 em_signed_data.set_data(att_signed_data.data()); |
| 331 em_signed_data.set_signature(att_signed_data.signature()); | 334 em_signed_data.set_signature(att_signed_data.signature()); |
| 332 em_signed_data.set_extra_data_bytes(att_signed_data.data().size() - | 335 em_signed_data.set_extra_data_bytes(att_signed_data.data().size() - |
| 333 data.size()); | 336 data.size()); |
| 334 } | 337 } |
| 335 callback.Run(success, em_signed_data); | 338 callback.Run(success, em_signed_data); |
| 336 } | 339 } |
| 337 | 340 |
| 338 } // namespace policy | 341 } // namespace policy |
| OLD | NEW |