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> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 11 #include "base/callback.h" |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
12 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
13 #include "base/values.h" | 15 #include "base/values.h" |
14 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 17 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
16 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" | 18 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // Do nothing. | 206 // Do nothing. |
205 } | 207 } |
206 | 208 |
207 void DeviceCloudPolicyInitializer::EnrollmentCompleted( | 209 void DeviceCloudPolicyInitializer::EnrollmentCompleted( |
208 const EnrollmentCallback& enrollment_callback, | 210 const EnrollmentCallback& enrollment_callback, |
209 EnrollmentStatus status) { | 211 EnrollmentStatus status) { |
210 scoped_ptr<CloudPolicyClient> client = enrollment_handler_->ReleaseClient(); | 212 scoped_ptr<CloudPolicyClient> client = enrollment_handler_->ReleaseClient(); |
211 enrollment_handler_.reset(); | 213 enrollment_handler_.reset(); |
212 | 214 |
213 if (status.status() == EnrollmentStatus::STATUS_SUCCESS) { | 215 if (status.status() == EnrollmentStatus::STATUS_SUCCESS) { |
214 StartConnection(client.Pass()); | 216 StartConnection(std::move(client)); |
215 } else { | 217 } else { |
216 // Some attempts to create a client may be blocked because the enrollment | 218 // Some attempts to create a client may be blocked because the enrollment |
217 // was in progress. We give it a try again. | 219 // was in progress. We give it a try again. |
218 TryToCreateClient(); | 220 TryToCreateClient(); |
219 } | 221 } |
220 | 222 |
221 if (!enrollment_callback.is_null()) | 223 if (!enrollment_callback.is_null()) |
222 enrollment_callback.Run(status); | 224 enrollment_callback.Run(status); |
223 } | 225 } |
224 | 226 |
(...skipping 28 matching lines...) Expand all Loading... |
253 service = enterprise_service_; | 255 service = enterprise_service_; |
254 } | 256 } |
255 | 257 |
256 if (service) | 258 if (service) |
257 StartConnection(CreateClient(service)); | 259 StartConnection(CreateClient(service)); |
258 } | 260 } |
259 | 261 |
260 void DeviceCloudPolicyInitializer::StartConnection( | 262 void DeviceCloudPolicyInitializer::StartConnection( |
261 scoped_ptr<CloudPolicyClient> client) { | 263 scoped_ptr<CloudPolicyClient> client) { |
262 if (!manager_->core()->service()) | 264 if (!manager_->core()->service()) |
263 manager_->StartConnection(client.Pass(), install_attributes_); | 265 manager_->StartConnection(std::move(client), install_attributes_); |
264 } | 266 } |
265 | 267 |
266 } // namespace policy | 268 } // namespace policy |
OLD | NEW |