| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/device_settings_provider.h" | 5 #include "chrome/browser/chromeos/device_settings_provider.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 void DeviceSettingsProvider::FinishSetInPolicy( | 293 void DeviceSettingsProvider::FinishSetInPolicy( |
| 294 const std::string& prop, | 294 const std::string& prop, |
| 295 const base::Value* value, | 295 const base::Value* value, |
| 296 SignedSettings::ReturnCode code, | 296 SignedSettings::ReturnCode code, |
| 297 const em::PolicyFetchResponse& policy) { | 297 const em::PolicyFetchResponse& policy) { |
| 298 if (code != SignedSettings::SUCCESS) { | 298 if (code != SignedSettings::SUCCESS) { |
| 299 LOG(ERROR) << "Can't serialize to policy error code: " << code; | 299 LOG(ERROR) << "Can't serialize to policy error code: " << code; |
| 300 Reload(); | 300 Reload(); |
| 301 return; | 301 return; |
| 302 } | 302 } |
| 303 // Update the internal caches and set the trusted flag to true so that we |
| 304 // can pass the trustedness check in the second call to SetInPolicy. |
| 305 OnRetrievePolicyCompleted(code, policy); |
| 306 |
| 303 SetInPolicy(prop, *value); | 307 SetInPolicy(prop, *value); |
| 304 } | 308 } |
| 305 | 309 |
| 306 void DeviceSettingsProvider::UpdateValuesCache() { | 310 void DeviceSettingsProvider::UpdateValuesCache() { |
| 307 const em::PolicyData data = policy(); | 311 const em::PolicyData data = policy(); |
| 308 values_cache_.Clear(); | 312 values_cache_.Clear(); |
| 309 | 313 |
| 310 if (data.has_username() && !data.has_request_token()) | 314 if (data.has_username() && !data.has_request_token()) |
| 311 values_cache_.SetString(kDeviceOwner, data.username()); | 315 values_cache_.SetString(kDeviceOwner, data.username()); |
| 312 | 316 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 Reload(); | 518 Reload(); |
| 515 return; | 519 return; |
| 516 } | 520 } |
| 517 LOG(ERROR) << "No retries left"; | 521 LOG(ERROR) << "No retries left"; |
| 518 break; | 522 break; |
| 519 } | 523 } |
| 520 } | 524 } |
| 521 } | 525 } |
| 522 | 526 |
| 523 } // namespace chromeos | 527 } // namespace chromeos |
| OLD | NEW |