| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 enrollment_callback.Run(status); | 257 enrollment_callback.Run(status); |
| 258 } | 258 } |
| 259 | 259 |
| 260 std::unique_ptr<CloudPolicyClient> DeviceCloudPolicyInitializer::CreateClient( | 260 std::unique_ptr<CloudPolicyClient> DeviceCloudPolicyInitializer::CreateClient( |
| 261 DeviceManagementService* device_management_service) { | 261 DeviceManagementService* device_management_service) { |
| 262 std::string machine_model; | 262 std::string machine_model; |
| 263 statistics_provider_->GetMachineStatistic(chromeos::system::kHardwareClassKey, | 263 statistics_provider_->GetMachineStatistic(chromeos::system::kHardwareClassKey, |
| 264 &machine_model); | 264 &machine_model); |
| 265 return base::MakeUnique<CloudPolicyClient>( | 265 return base::MakeUnique<CloudPolicyClient>( |
| 266 statistics_provider_->GetEnterpriseMachineID(), machine_model, | 266 statistics_provider_->GetEnterpriseMachineID(), machine_model, |
| 267 kPolicyVerificationKeyHash, device_management_service, | 267 device_management_service, g_browser_process->system_request_context(), |
| 268 g_browser_process->system_request_context(), signing_service_.get()); | 268 signing_service_.get()); |
| 269 } | 269 } |
| 270 | 270 |
| 271 void DeviceCloudPolicyInitializer::TryToCreateClient() { | 271 void DeviceCloudPolicyInitializer::TryToCreateClient() { |
| 272 if (!device_store_->is_initialized() || | 272 if (!device_store_->is_initialized() || |
| 273 !device_store_->has_policy() || | 273 !device_store_->has_policy() || |
| 274 state_keys_broker_->pending() || | 274 state_keys_broker_->pending() || |
| 275 enrollment_handler_) { | 275 enrollment_handler_) { |
| 276 return; | 276 return; |
| 277 } | 277 } |
| 278 StartConnection(CreateClient(enterprise_service_)); | 278 StartConnection(CreateClient(enterprise_service_)); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 if (success && (success = att_signed_data.ParseFromString(signed_data))) { | 328 if (success && (success = att_signed_data.ParseFromString(signed_data))) { |
| 329 em_signed_data.set_data(att_signed_data.data()); | 329 em_signed_data.set_data(att_signed_data.data()); |
| 330 em_signed_data.set_signature(att_signed_data.signature()); | 330 em_signed_data.set_signature(att_signed_data.signature()); |
| 331 em_signed_data.set_extra_data_bytes(att_signed_data.data().size() - | 331 em_signed_data.set_extra_data_bytes(att_signed_data.data().size() - |
| 332 data.size()); | 332 data.size()); |
| 333 } | 333 } |
| 334 callback.Run(success, em_signed_data); | 334 callback.Run(success, em_signed_data); |
| 335 } | 335 } |
| 336 | 336 |
| 337 } // namespace policy | 337 } // namespace policy |
| OLD | NEW |