OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 USER_AFFILIATION_NONE, | 234 USER_AFFILIATION_NONE, |
235 device_status_provider_.get(), | 235 device_status_provider_.get(), |
236 device_management_service_)); | 236 device_management_service_)); |
237 } | 237 } |
238 | 238 |
239 void DeviceCloudPolicyManagerChromeOS::EnrollmentCompleted( | 239 void DeviceCloudPolicyManagerChromeOS::EnrollmentCompleted( |
240 const EnrollmentCallback& callback, | 240 const EnrollmentCallback& callback, |
241 EnrollmentStatus status) { | 241 EnrollmentStatus status) { |
242 if (status.status() == EnrollmentStatus::STATUS_SUCCESS) { | 242 if (status.status() == EnrollmentStatus::STATUS_SUCCESS) { |
243 core()->Connect(enrollment_handler_->ReleaseClient()); | 243 core()->Connect(enrollment_handler_->ReleaseClient()); |
244 core()->StartRefreshScheduler(); | 244 StartRefreshScheduler(); |
245 core()->TrackRefreshDelayPref(local_state_, | 245 core()->TrackRefreshDelayPref(local_state_, |
246 prefs::kDevicePolicyRefreshRate); | 246 prefs::kDevicePolicyRefreshRate); |
247 attestation_policy_observer_.reset( | 247 attestation_policy_observer_.reset( |
248 new chromeos::attestation::AttestationPolicyObserver(client())); | 248 new chromeos::attestation::AttestationPolicyObserver(client())); |
249 } else { | 249 } else { |
250 StartIfManaged(); | 250 StartIfManaged(); |
251 } | 251 } |
252 | 252 |
253 enrollment_handler_.reset(); | 253 enrollment_handler_.reset(); |
254 if (!callback.is_null()) | 254 if (!callback.is_null()) |
255 callback.Run(status); | 255 callback.Run(status); |
256 } | 256 } |
257 | 257 |
258 void DeviceCloudPolicyManagerChromeOS::StartIfManaged() { | 258 void DeviceCloudPolicyManagerChromeOS::StartIfManaged() { |
259 if (device_management_service_ && | 259 if (device_management_service_ && |
260 local_state_ && | 260 local_state_ && |
261 store()->is_initialized() && | 261 store()->is_initialized() && |
262 store()->is_managed() && | 262 store()->is_managed() && |
263 !service()) { | 263 !service()) { |
264 core()->Connect(CreateClient()); | 264 core()->Connect(CreateClient()); |
265 core()->StartRefreshScheduler(); | 265 StartRefreshScheduler(); |
266 core()->TrackRefreshDelayPref(local_state_, | 266 core()->TrackRefreshDelayPref(local_state_, |
267 prefs::kDevicePolicyRefreshRate); | 267 prefs::kDevicePolicyRefreshRate); |
268 attestation_policy_observer_.reset( | 268 attestation_policy_observer_.reset( |
269 new chromeos::attestation::AttestationPolicyObserver(client())); | 269 new chromeos::attestation::AttestationPolicyObserver(client())); |
270 } | 270 } |
271 } | 271 } |
272 | 272 |
273 } // namespace policy | 273 } // namespace policy |
OLD | NEW |