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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 156 } |
156 | 157 |
157 void DeviceCloudPolicyManagerChromeOS::EnrollmentCompleted( | 158 void DeviceCloudPolicyManagerChromeOS::EnrollmentCompleted( |
158 const EnrollmentCallback& callback, | 159 const EnrollmentCallback& callback, |
159 EnrollmentStatus status) { | 160 EnrollmentStatus status) { |
160 if (status.status() == EnrollmentStatus::STATUS_SUCCESS) { | 161 if (status.status() == EnrollmentStatus::STATUS_SUCCESS) { |
161 core()->Connect(enrollment_handler_->ReleaseClient()); | 162 core()->Connect(enrollment_handler_->ReleaseClient()); |
162 core()->StartRefreshScheduler(); | 163 core()->StartRefreshScheduler(); |
163 core()->TrackRefreshDelayPref(local_state_, | 164 core()->TrackRefreshDelayPref(local_state_, |
164 prefs::kDevicePolicyRefreshRate); | 165 prefs::kDevicePolicyRefreshRate); |
| 166 attestation_policy_observer_.reset( |
| 167 new chromeos::attestation::AttestationPolicyObserver(client())); |
165 } else { | 168 } else { |
166 StartIfManaged(); | 169 StartIfManaged(); |
167 } | 170 } |
168 | 171 |
169 enrollment_handler_.reset(); | 172 enrollment_handler_.reset(); |
170 if (!callback.is_null()) | 173 if (!callback.is_null()) |
171 callback.Run(status); | 174 callback.Run(status); |
172 } | 175 } |
173 | 176 |
174 void DeviceCloudPolicyManagerChromeOS::StartIfManaged() { | 177 void DeviceCloudPolicyManagerChromeOS::StartIfManaged() { |
175 if (device_management_service_ && | 178 if (device_management_service_ && |
176 local_state_ && | 179 local_state_ && |
177 store()->is_initialized() && | 180 store()->is_initialized() && |
178 store()->is_managed() && | 181 store()->is_managed() && |
179 !service()) { | 182 !service()) { |
180 core()->Connect(CreateClient()); | 183 core()->Connect(CreateClient()); |
181 core()->StartRefreshScheduler(); | 184 core()->StartRefreshScheduler(); |
182 core()->TrackRefreshDelayPref(local_state_, | 185 core()->TrackRefreshDelayPref(local_state_, |
183 prefs::kDevicePolicyRefreshRate); | 186 prefs::kDevicePolicyRefreshRate); |
| 187 attestation_policy_observer_.reset( |
| 188 new chromeos::attestation::AttestationPolicyObserver(client())); |
184 } | 189 } |
185 } | 190 } |
186 | 191 |
187 } // namespace policy | 192 } // namespace policy |
OLD | NEW |