| 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_store_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 } | 178 } |
| 179 | 179 |
| 180 void DeviceCloudPolicyStoreChromeOS::UpdateStatusFromService() { | 180 void DeviceCloudPolicyStoreChromeOS::UpdateStatusFromService() { |
| 181 switch (device_settings_service_->status()) { | 181 switch (device_settings_service_->status()) { |
| 182 case chromeos::DeviceSettingsService::STORE_SUCCESS: | 182 case chromeos::DeviceSettingsService::STORE_SUCCESS: |
| 183 status_ = STATUS_OK; | 183 status_ = STATUS_OK; |
| 184 return; | 184 return; |
| 185 case chromeos::DeviceSettingsService::STORE_KEY_UNAVAILABLE: | 185 case chromeos::DeviceSettingsService::STORE_KEY_UNAVAILABLE: |
| 186 status_ = STATUS_BAD_STATE; | 186 status_ = STATUS_BAD_STATE; |
| 187 return; | 187 return; |
| 188 case chromeos::DeviceSettingsService::STORE_POLICY_ERROR: | |
| 189 case chromeos::DeviceSettingsService::STORE_OPERATION_FAILED: | 188 case chromeos::DeviceSettingsService::STORE_OPERATION_FAILED: |
| 190 status_ = STATUS_STORE_ERROR; | 189 status_ = STATUS_STORE_ERROR; |
| 191 return; | 190 return; |
| 192 case chromeos::DeviceSettingsService::STORE_NO_POLICY: | 191 case chromeos::DeviceSettingsService::STORE_NO_POLICY: |
| 193 case chromeos::DeviceSettingsService::STORE_INVALID_POLICY: | 192 case chromeos::DeviceSettingsService::STORE_INVALID_POLICY: |
| 194 case chromeos::DeviceSettingsService::STORE_VALIDATION_ERROR: | 193 case chromeos::DeviceSettingsService::STORE_VALIDATION_ERROR: |
| 195 case chromeos::DeviceSettingsService::STORE_TEMP_VALIDATION_ERROR: | |
| 196 status_ = STATUS_LOAD_ERROR; | 194 status_ = STATUS_LOAD_ERROR; |
| 197 return; | 195 return; |
| 198 } | 196 } |
| 199 NOTREACHED(); | 197 NOTREACHED(); |
| 200 } | 198 } |
| 201 | 199 |
| 202 void DeviceCloudPolicyStoreChromeOS::CheckDMToken() { | 200 void DeviceCloudPolicyStoreChromeOS::CheckDMToken() { |
| 203 const chromeos::DeviceSettingsService::Status service_status = | 201 const chromeos::DeviceSettingsService::Status service_status = |
| 204 device_settings_service_->status(); | 202 device_settings_service_->status(); |
| 205 switch (service_status) { | 203 switch (service_status) { |
| 206 case chromeos::DeviceSettingsService::STORE_SUCCESS: | 204 case chromeos::DeviceSettingsService::STORE_SUCCESS: |
| 207 case chromeos::DeviceSettingsService::STORE_KEY_UNAVAILABLE: | 205 case chromeos::DeviceSettingsService::STORE_KEY_UNAVAILABLE: |
| 208 case chromeos::DeviceSettingsService::STORE_NO_POLICY: | 206 case chromeos::DeviceSettingsService::STORE_NO_POLICY: |
| 209 case chromeos::DeviceSettingsService::STORE_INVALID_POLICY: | 207 case chromeos::DeviceSettingsService::STORE_INVALID_POLICY: |
| 210 case chromeos::DeviceSettingsService::STORE_VALIDATION_ERROR: | 208 case chromeos::DeviceSettingsService::STORE_VALIDATION_ERROR: |
| 211 // Continue with the check below. | 209 // Continue with the check below. |
| 212 break; | 210 break; |
| 213 case chromeos::DeviceSettingsService::STORE_POLICY_ERROR: | |
| 214 case chromeos::DeviceSettingsService::STORE_OPERATION_FAILED: | 211 case chromeos::DeviceSettingsService::STORE_OPERATION_FAILED: |
| 215 case chromeos::DeviceSettingsService::STORE_TEMP_VALIDATION_ERROR: | |
| 216 // Don't check for write errors or transient read errors. | 212 // Don't check for write errors or transient read errors. |
| 217 return; | 213 return; |
| 218 } | 214 } |
| 219 | 215 |
| 220 if (dm_token_checked_) { | 216 if (dm_token_checked_) { |
| 221 return; | 217 return; |
| 222 } | 218 } |
| 223 dm_token_checked_ = true; | 219 dm_token_checked_ = true; |
| 224 | 220 |
| 225 // PolicyData from Active Directory doesn't contain a DM token. | 221 // PolicyData from Active Directory doesn't contain a DM token. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 237 UMA_HISTOGRAM_BOOLEAN(kDMTokenCheckHistogram, true); | 233 UMA_HISTOGRAM_BOOLEAN(kDMTokenCheckHistogram, true); |
| 238 } else { | 234 } else { |
| 239 LOG(ERROR) << "Device policy read on enrolled device yields " | 235 LOG(ERROR) << "Device policy read on enrolled device yields " |
| 240 << "no DM token! Status: " << service_status << "."; | 236 << "no DM token! Status: " << service_status << "."; |
| 241 chromeos::StartupUtils::MarkEnrollmentRecoveryRequired(); | 237 chromeos::StartupUtils::MarkEnrollmentRecoveryRequired(); |
| 242 UMA_HISTOGRAM_BOOLEAN(kDMTokenCheckHistogram, false); | 238 UMA_HISTOGRAM_BOOLEAN(kDMTokenCheckHistogram, false); |
| 243 } | 239 } |
| 244 } | 240 } |
| 245 | 241 |
| 246 } // namespace policy | 242 } // namespace policy |
| OLD | NEW |