| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 USER_AFFILIATION_NONE, | 232 USER_AFFILIATION_NONE, |
| 233 device_status_provider_.get(), | 233 device_status_provider_.get(), |
| 234 device_management_service_)); | 234 device_management_service_)); |
| 235 } | 235 } |
| 236 | 236 |
| 237 void DeviceCloudPolicyManagerChromeOS::EnrollmentCompleted( | 237 void DeviceCloudPolicyManagerChromeOS::EnrollmentCompleted( |
| 238 const EnrollmentCallback& callback, | 238 const EnrollmentCallback& callback, |
| 239 EnrollmentStatus status) { | 239 EnrollmentStatus status) { |
| 240 if (status.status() == EnrollmentStatus::STATUS_SUCCESS) { | 240 if (status.status() == EnrollmentStatus::STATUS_SUCCESS) { |
| 241 core()->Connect(enrollment_handler_->ReleaseClient()); | 241 core()->Connect(enrollment_handler_->ReleaseClient()); |
| 242 StartRefreshScheduler(); | 242 core()->StartRefreshScheduler(); |
| 243 core()->TrackRefreshDelayPref(local_state_, | 243 core()->TrackRefreshDelayPref(local_state_, |
| 244 prefs::kDevicePolicyRefreshRate); | 244 prefs::kDevicePolicyRefreshRate); |
| 245 attestation_policy_observer_.reset( | 245 attestation_policy_observer_.reset( |
| 246 new chromeos::attestation::AttestationPolicyObserver(client())); | 246 new chromeos::attestation::AttestationPolicyObserver(client())); |
| 247 } else { | 247 } else { |
| 248 StartIfManaged(); | 248 StartIfManaged(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 enrollment_handler_.reset(); | 251 enrollment_handler_.reset(); |
| 252 if (!callback.is_null()) | 252 if (!callback.is_null()) |
| 253 callback.Run(status); | 253 callback.Run(status); |
| 254 } | 254 } |
| 255 | 255 |
| 256 void DeviceCloudPolicyManagerChromeOS::StartIfManaged() { | 256 void DeviceCloudPolicyManagerChromeOS::StartIfManaged() { |
| 257 if (device_management_service_ && | 257 if (device_management_service_ && |
| 258 local_state_ && | 258 local_state_ && |
| 259 store()->is_initialized() && | 259 store()->is_initialized() && |
| 260 store()->is_managed() && | 260 store()->is_managed() && |
| 261 !service()) { | 261 !service()) { |
| 262 core()->Connect(CreateClient()); | 262 core()->Connect(CreateClient()); |
| 263 StartRefreshScheduler(); | 263 core()->StartRefreshScheduler(); |
| 264 core()->TrackRefreshDelayPref(local_state_, | 264 core()->TrackRefreshDelayPref(local_state_, |
| 265 prefs::kDevicePolicyRefreshRate); | 265 prefs::kDevicePolicyRefreshRate); |
| 266 attestation_policy_observer_.reset( | 266 attestation_policy_observer_.reset( |
| 267 new chromeos::attestation::AttestationPolicyObserver(client())); | 267 new chromeos::attestation::AttestationPolicyObserver(client())); |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 | 270 |
| 271 } // namespace policy | 271 } // namespace policy |
| OLD | NEW |