| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 if (policy_data) | 156 if (policy_data) |
| 157 policy_->MergeFrom(*policy_data); | 157 policy_->MergeFrom(*policy_data); |
| 158 | 158 |
| 159 PolicyMap new_policy_map; | 159 PolicyMap new_policy_map; |
| 160 if (is_managed()) { | 160 if (is_managed()) { |
| 161 DecodeDevicePolicy(*device_settings_service_->device_settings(), | 161 DecodeDevicePolicy(*device_settings_service_->device_settings(), |
| 162 &new_policy_map); | 162 &new_policy_map); |
| 163 } | 163 } |
| 164 policy_map_.Swap(&new_policy_map); | 164 policy_map_.Swap(&new_policy_map); |
| 165 | 165 |
| 166 scoped_refptr<ownership::PublicKey> key = |
| 167 device_settings_service_->GetPublicKey(); |
| 168 public_key_ = key ? key->as_string() : std::string(); |
| 169 |
| 166 NotifyStoreLoaded(); | 170 NotifyStoreLoaded(); |
| 167 return; | 171 return; |
| 168 } | 172 } |
| 169 NotifyStoreError(); | 173 NotifyStoreError(); |
| 170 } | 174 } |
| 171 | 175 |
| 172 void DeviceCloudPolicyStoreChromeOS::UpdateStatusFromService() { | 176 void DeviceCloudPolicyStoreChromeOS::UpdateStatusFromService() { |
| 173 switch (device_settings_service_->status()) { | 177 switch (device_settings_service_->status()) { |
| 174 case chromeos::DeviceSettingsService::STORE_SUCCESS: | 178 case chromeos::DeviceSettingsService::STORE_SUCCESS: |
| 175 status_ = STATUS_OK; | 179 status_ = STATUS_OK; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 UMA_HISTOGRAM_BOOLEAN(kDMTokenCheckHistogram, true); | 228 UMA_HISTOGRAM_BOOLEAN(kDMTokenCheckHistogram, true); |
| 225 } else { | 229 } else { |
| 226 LOG(ERROR) << "Device policy read on enrolled device yields " | 230 LOG(ERROR) << "Device policy read on enrolled device yields " |
| 227 << "no DM token! Status: " << service_status << "."; | 231 << "no DM token! Status: " << service_status << "."; |
| 228 chromeos::StartupUtils::MarkEnrollmentRecoveryRequired(); | 232 chromeos::StartupUtils::MarkEnrollmentRecoveryRequired(); |
| 229 UMA_HISTOGRAM_BOOLEAN(kDMTokenCheckHistogram, false); | 233 UMA_HISTOGRAM_BOOLEAN(kDMTokenCheckHistogram, false); |
| 230 } | 234 } |
| 231 } | 235 } |
| 232 | 236 |
| 233 } // namespace policy | 237 } // namespace policy |
| OLD | NEW |