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

Side by Side Diff: services/preferences/public/cpp/pref_observer_store.cc

Issue 2474653003: PreferencesManager (Closed)
Patch Set: Rebase Created 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "services/preferences/public/cpp/pref_observer_store.h" 5 #include "services/preferences/public/cpp/pref_observer_store.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "mojo/common/common_custom_types.mojom.h" 8 #include "mojo/common/common_custom_types.mojom.h"
9 #include "mojo/public/cpp/bindings/array.h" 9 #include "mojo/public/cpp/bindings/array.h"
10 #include "services/service_manager/public/cpp/connector.h" 10 #include "services/service_manager/public/cpp/connector.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 prefs_manager_ptr_->SetPreferences(prefs); 84 prefs_manager_ptr_->SetPreferences(prefs);
85 } 85 }
86 86
87 void PrefObserverStore::OnPreferencesChanged( 87 void PrefObserverStore::OnPreferencesChanged(
88 const base::DictionaryValue& preferences) { 88 const base::DictionaryValue& preferences) {
89 for (base::DictionaryValue::Iterator it(preferences); !it.IsAtEnd(); 89 for (base::DictionaryValue::Iterator it(preferences); !it.IsAtEnd();
90 it.Advance()) { 90 it.Advance()) {
91 if (keys_.find(it.key()) == keys_.end()) 91 if (keys_.find(it.key()) == keys_.end())
92 continue; 92 continue;
93 // We deliberately call the parent to avoid notifying the server again. 93 // We deliberately call the parent to avoid notifying the server again.
94 ValueMapPrefStore::SetValue(it.key(), it.value().CreateDeepCopy(), 0); 94 if (!initialized_) {
95 ValueMapPrefStore::SetValueSilently(it.key(), it.value().CreateDeepCopy(),
96 0);
97 } else {
98 ValueMapPrefStore::SetValue(it.key(), it.value().CreateDeepCopy(), 0);
99 }
95 } 100 }
96 101
97 if (!initialized_) { 102 if (!initialized_) {
98 initialized_ = true; 103 initialized_ = true;
99 NotifyInitializationCompleted(); 104 NotifyInitializationCompleted();
100 } 105 }
101 } 106 }
OLDNEW
« chrome/browser/prefs/preferences_manager.cc ('K') | « chrome/test/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698