| 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/settings/device_settings_service.h" | 5 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 owner_key_ = new_key; | 344 owner_key_ = new_key; |
| 345 new_owner_key = true; | 345 new_owner_key = true; |
| 346 } | 346 } |
| 347 | 347 |
| 348 if (status == STORE_SUCCESS) { | 348 if (status == STORE_SUCCESS) { |
| 349 policy_data_ = operation->policy_data().Pass(); | 349 policy_data_ = operation->policy_data().Pass(); |
| 350 device_settings_ = operation->device_settings().Pass(); | 350 device_settings_ = operation->device_settings().Pass(); |
| 351 load_retries_left_ = kMaxLoadRetries; | 351 load_retries_left_ = kMaxLoadRetries; |
| 352 } else if (status != STORE_KEY_UNAVAILABLE) { | 352 } else if (status != STORE_KEY_UNAVAILABLE) { |
| 353 LOG(ERROR) << "Session manager operation failed: " << status; | 353 LOG(ERROR) << "Session manager operation failed: " << status; |
| 354 // Validation errors can be temprary if the rtc has went on holiday for a | 354 // Validation errors can be temporary if the rtc has gone on holiday for a |
| 355 // short while. So we will retry such loads for up to 10 minutes. | 355 // short while. So we will retry such loads for up to 10 minutes. |
| 356 if (status == STORE_TEMP_VALIDATION_ERROR) { | 356 if (status == STORE_TEMP_VALIDATION_ERROR) { |
| 357 if (load_retries_left_ > 0) { | 357 if (load_retries_left_ > 0) { |
| 358 load_retries_left_--; | 358 load_retries_left_--; |
| 359 LOG(ERROR) << "A re-load has been scheduled due to a validation error."; | 359 LOG(ERROR) << "A re-load has been scheduled due to a validation error."; |
| 360 content::BrowserThread::PostDelayedTask( | 360 content::BrowserThread::PostDelayedTask( |
| 361 content::BrowserThread::UI, | 361 content::BrowserThread::UI, |
| 362 FROM_HERE, | 362 FROM_HERE, |
| 363 base::Bind(&DeviceSettingsService::Load, base::Unretained(this)), | 363 base::Bind(&DeviceSettingsService::Load, base::Unretained(this)), |
| 364 base::TimeDelta::FromMilliseconds(kLoadRetryDelayMs)); | 364 base::TimeDelta::FromMilliseconds(kLoadRetryDelayMs)); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 DeviceSettingsService::Initialize(); | 488 DeviceSettingsService::Initialize(); |
| 489 } | 489 } |
| 490 | 490 |
| 491 ScopedTestDeviceSettingsService::~ScopedTestDeviceSettingsService() { | 491 ScopedTestDeviceSettingsService::~ScopedTestDeviceSettingsService() { |
| 492 // Clean pending operations. | 492 // Clean pending operations. |
| 493 DeviceSettingsService::Get()->UnsetSessionManager(); | 493 DeviceSettingsService::Get()->UnsetSessionManager(); |
| 494 DeviceSettingsService::Shutdown(); | 494 DeviceSettingsService::Shutdown(); |
| 495 } | 495 } |
| 496 | 496 |
| 497 } // namespace chromeos | 497 } // namespace chromeos |
| OLD | NEW |