| 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 "chrome/browser/chromeos/attestation/attestation_policy_observer.h" |
| 9 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" | 10 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" |
| 10 #include "chrome/browser/chromeos/policy/enrollment_handler_chromeos.h" | 11 #include "chrome/browser/chromeos/policy/enrollment_handler_chromeos.h" |
| 11 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 12 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
| 12 #include "chrome/browser/chromeos/system/statistics_provider.h" | 13 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 13 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" | 14 #include "chrome/browser/policy/cloud/cloud_policy_constants.h" |
| 14 #include "chrome/browser/policy/cloud/cloud_policy_store.h" | 15 #include "chrome/browser/policy/cloud/cloud_policy_store.h" |
| 15 #include "chrome/browser/policy/cloud/device_management_service.h" | 16 #include "chrome/browser/policy/cloud/device_management_service.h" |
| 16 #include "chrome/browser/policy/cloud/proto/device_management_backend.pb.h" | 17 #include "chrome/browser/policy/cloud/proto/device_management_backend.pb.h" |
| 17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 18 | 19 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 151 } |
| 151 | 152 |
| 152 void DeviceCloudPolicyManagerChromeOS::EnrollmentCompleted( | 153 void DeviceCloudPolicyManagerChromeOS::EnrollmentCompleted( |
| 153 const EnrollmentCallback& callback, | 154 const EnrollmentCallback& callback, |
| 154 EnrollmentStatus status) { | 155 EnrollmentStatus status) { |
| 155 if (status.status() == EnrollmentStatus::STATUS_SUCCESS) { | 156 if (status.status() == EnrollmentStatus::STATUS_SUCCESS) { |
| 156 core()->Connect(enrollment_handler_->ReleaseClient()); | 157 core()->Connect(enrollment_handler_->ReleaseClient()); |
| 157 core()->StartRefreshScheduler(); | 158 core()->StartRefreshScheduler(); |
| 158 core()->TrackRefreshDelayPref(local_state_, | 159 core()->TrackRefreshDelayPref(local_state_, |
| 159 prefs::kDevicePolicyRefreshRate); | 160 prefs::kDevicePolicyRefreshRate); |
| 161 attestation_policy_observer_.reset( |
| 162 new chromeos::attestation::AttestationPolicyObserver(client())); |
| 160 } else { | 163 } else { |
| 161 StartIfManaged(); | 164 StartIfManaged(); |
| 162 } | 165 } |
| 163 | 166 |
| 164 enrollment_handler_.reset(); | 167 enrollment_handler_.reset(); |
| 165 if (!callback.is_null()) | 168 if (!callback.is_null()) |
| 166 callback.Run(status); | 169 callback.Run(status); |
| 167 } | 170 } |
| 168 | 171 |
| 169 void DeviceCloudPolicyManagerChromeOS::StartIfManaged() { | 172 void DeviceCloudPolicyManagerChromeOS::StartIfManaged() { |
| 170 if (device_management_service_ && | 173 if (device_management_service_ && |
| 171 local_state_ && | 174 local_state_ && |
| 172 store()->is_initialized() && | 175 store()->is_initialized() && |
| 173 store()->is_managed() && | 176 store()->is_managed() && |
| 174 !service()) { | 177 !service()) { |
| 175 core()->Connect(CreateClient()); | 178 core()->Connect(CreateClient()); |
| 176 core()->StartRefreshScheduler(); | 179 core()->StartRefreshScheduler(); |
| 177 core()->TrackRefreshDelayPref(local_state_, | 180 core()->TrackRefreshDelayPref(local_state_, |
| 178 prefs::kDevicePolicyRefreshRate); | 181 prefs::kDevicePolicyRefreshRate); |
| 182 attestation_policy_observer_.reset( |
| 183 new chromeos::attestation::AttestationPolicyObserver(client())); |
| 179 } | 184 } |
| 180 } | 185 } |
| 181 | 186 |
| 182 } // namespace policy | 187 } // namespace policy |
| OLD | NEW |