| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 if (!enrollment_callback.is_null()) | 245 if (!enrollment_callback.is_null()) |
| 246 enrollment_callback.Run(status); | 246 enrollment_callback.Run(status); |
| 247 } | 247 } |
| 248 | 248 |
| 249 std::unique_ptr<CloudPolicyClient> DeviceCloudPolicyInitializer::CreateClient( | 249 std::unique_ptr<CloudPolicyClient> DeviceCloudPolicyInitializer::CreateClient( |
| 250 DeviceManagementService* device_management_service) { | 250 DeviceManagementService* device_management_service) { |
| 251 return base::MakeUnique<CloudPolicyClient>( | 251 return base::MakeUnique<CloudPolicyClient>( |
| 252 DeviceCloudPolicyManagerChromeOS::GetMachineID(), | 252 DeviceCloudPolicyManagerChromeOS::GetMachineID(), |
| 253 DeviceCloudPolicyManagerChromeOS::GetMachineModel(), | 253 DeviceCloudPolicyManagerChromeOS::GetMachineModel(), |
| 254 kPolicyVerificationKeyHash, device_management_service, | 254 kPolicyVerificationKeyHash, device_management_service, |
| 255 g_browser_process->system_request_context()); | 255 g_browser_process->system_request_context(), |
| 256 nullptr /* signing_service */); |
| 256 } | 257 } |
| 257 | 258 |
| 258 void DeviceCloudPolicyInitializer::TryToCreateClient() { | 259 void DeviceCloudPolicyInitializer::TryToCreateClient() { |
| 259 if (!device_store_->is_initialized() || | 260 if (!device_store_->is_initialized() || |
| 260 !device_store_->has_policy() || | 261 !device_store_->has_policy() || |
| 261 state_keys_broker_->pending() || | 262 state_keys_broker_->pending() || |
| 262 enrollment_handler_) { | 263 enrollment_handler_) { |
| 263 return; | 264 return; |
| 264 } | 265 } |
| 265 StartConnection(CreateClient(enterprise_service_)); | 266 StartConnection(CreateClient(enterprise_service_)); |
| 266 } | 267 } |
| 267 | 268 |
| 268 void DeviceCloudPolicyInitializer::StartConnection( | 269 void DeviceCloudPolicyInitializer::StartConnection( |
| 269 std::unique_ptr<CloudPolicyClient> client) { | 270 std::unique_ptr<CloudPolicyClient> client) { |
| 270 if (!manager_->core()->service()) | 271 if (!manager_->core()->service()) |
| 271 manager_->StartConnection(std::move(client), install_attributes_); | 272 manager_->StartConnection(std::move(client), install_attributes_); |
| 272 } | 273 } |
| 273 | 274 |
| 274 } // namespace policy | 275 } // namespace policy |
| OLD | NEW |