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

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

Issue 695193004: Added key-value storage for pending changes to OwnerSettingsServiceChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes. Created 6 years, 1 month 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
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/logging.h" 10 #include "base/logging.h"
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 580
581 void DeviceSettingsProvider::DeviceSettingsUpdated() { 581 void DeviceSettingsProvider::DeviceSettingsUpdated() {
582 if (!store_callback_factory_.HasWeakPtrs()) 582 if (!store_callback_factory_.HasWeakPtrs())
583 UpdateAndProceedStoring(); 583 UpdateAndProceedStoring();
584 } 584 }
585 585
586 void DeviceSettingsProvider::OnDeviceSettingsServiceShutdown() { 586 void DeviceSettingsProvider::OnDeviceSettingsServiceShutdown() {
587 device_settings_service_ = nullptr; 587 device_settings_service_ = nullptr;
588 } 588 }
589 589
590 void DeviceSettingsProvider::OnTentativeChangesInPolicy( 590 void DeviceSettingsProvider::OnTentativeChangeInSettings(
591 const em::PolicyData& policy_data) { 591 const std::string& setting,
592 em::ChromeDeviceSettingsProto device_settings; 592 const base::Value& value) {
593 CHECK(device_settings.ParseFromString(policy_data.policy_value())); 593 em::ChromeDeviceSettingsProto settings = device_settings_;
594 UpdateValuesCache(policy_data, device_settings, TEMPORARILY_UNTRUSTED); 594 OwnerSettingsServiceChromeOS::UpdateDeviceSettings(setting, value, settings);
Mattias Nissler (ping if slow) 2014/11/10 11:31:20 If you need to build a device settings blob here a
ygorshenin1 2014/11/10 14:28:35 Done.
595 em::PolicyData data;
596 data.set_username(device_settings_service_->GetUsername());
597 CHECK(settings.SerializeToString(data.mutable_policy_value()));
598 UpdateValuesCache(data, settings, TEMPORARILY_UNTRUSTED);
595 } 599 }
596 600
597 void DeviceSettingsProvider::RetrieveCachedData() { 601 void DeviceSettingsProvider::RetrieveCachedData() {
598 em::PolicyData policy_data; 602 em::PolicyData policy_data;
599 if (!device_settings_cache::Retrieve(&policy_data, 603 if (!device_settings_cache::Retrieve(&policy_data,
600 g_browser_process->local_state()) || 604 g_browser_process->local_state()) ||
601 !device_settings_.ParseFromString(policy_data.policy_value())) { 605 !device_settings_.ParseFromString(policy_data.policy_value())) {
602 VLOG(1) << "Can't retrieve temp store, possibly not created yet."; 606 VLOG(1) << "Can't retrieve temp store, possibly not created yet.";
603 } 607 }
604 608
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 void DeviceSettingsProvider::AttemptMigration() { 819 void DeviceSettingsProvider::AttemptMigration() {
816 if (device_settings_service_->HasPrivateOwnerKey()) { 820 if (device_settings_service_->HasPrivateOwnerKey()) {
817 PrefValueMap::const_iterator i; 821 PrefValueMap::const_iterator i;
818 for (i = migration_values_.begin(); i != migration_values_.end(); ++i) 822 for (i = migration_values_.begin(); i != migration_values_.end(); ++i)
819 DoSet(i->first, *i->second); 823 DoSet(i->first, *i->second);
820 migration_values_.Clear(); 824 migration_values_.Clear();
821 } 825 }
822 } 826 }
823 827
824 } // namespace chromeos 828 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/settings/device_settings_provider.h ('k') | components/ownership/owner_settings_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698