Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(556)

Side by Side Diff: chrome/browser/chromeos/settings/device_settings_provider.cc

Issue 10950032: Fix queued writes in DeviceSettingsProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove redundant EXPECT_CALL. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/settings/device_settings_provider_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_provider.h" 5 #include "chrome/browser/chromeos/settings/device_settings_provider.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 "base/callback.h" 9 #include "base/callback.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 if (ownership_status_ == DeviceSettingsService::OWNERSHIP_NONE) 651 if (ownership_status_ == DeviceSettingsService::OWNERSHIP_NONE)
652 return TRUSTED; 652 return TRUSTED;
653 return trusted_status_; 653 return trusted_status_;
654 } 654 }
655 655
656 void DeviceSettingsProvider::UpdateAndProceedStoring() { 656 void DeviceSettingsProvider::UpdateAndProceedStoring() {
657 // Re-sync the cache from the service. 657 // Re-sync the cache from the service.
658 UpdateFromService(); 658 UpdateFromService();
659 659
660 // Trigger the next change if necessary. 660 // Trigger the next change if necessary.
661 if (trusted_status_ == TRUSTED && 661 if (trusted_status_ == TRUSTED && !pending_changes_.empty())
662 !store_callback_factory_.HasWeakPtrs() &&
663 !pending_changes_.empty()) {
664 SetInPolicy(); 662 SetInPolicy();
665 }
666 } 663 }
667 664
668 bool DeviceSettingsProvider::UpdateFromService() { 665 bool DeviceSettingsProvider::UpdateFromService() {
669 bool settings_loaded = false; 666 bool settings_loaded = false;
670 switch (device_settings_service_->status()) { 667 switch (device_settings_service_->status()) {
671 case DeviceSettingsService::STORE_SUCCESS: { 668 case DeviceSettingsService::STORE_SUCCESS: {
672 const em::PolicyData* policy_data = 669 const em::PolicyData* policy_data =
673 device_settings_service_->policy_data(); 670 device_settings_service_->policy_data();
674 const em::ChromeDeviceSettingsProto* device_settings = 671 const em::ChromeDeviceSettingsProto* device_settings =
675 device_settings_service_->device_settings(); 672 device_settings_service_->device_settings();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 void DeviceSettingsProvider::AttemptMigration() { 728 void DeviceSettingsProvider::AttemptMigration() {
732 if (device_settings_service_->HasPrivateOwnerKey()) { 729 if (device_settings_service_->HasPrivateOwnerKey()) {
733 PrefValueMap::const_iterator i; 730 PrefValueMap::const_iterator i;
734 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) 731 for (i = migration_values_.begin(); i != migration_values_.end(); ++i)
735 DoSet(i->first, *i->second); 732 DoSet(i->first, *i->second);
736 migration_values_.Clear(); 733 migration_values_.Clear();
737 } 734 }
738 } 735 }
739 736
740 } // namespace chromeos 737 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/settings/device_settings_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698