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

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

Issue 2778643002: Pref service: Filter updates from read-only pref stores. (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_store_client_mixin.h" 5 #include "services/preferences/public/cpp/pref_store_client_mixin.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "services/preferences/public/cpp/pref_store_client.h" 10 #include "services/preferences/public/cpp/pref_store_client.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (cached_prefs_->Get(key, &prev)) { 95 if (cached_prefs_->Get(key, &prev)) {
96 if (!prev->Equals(value.get())) { 96 if (!prev->Equals(value.get())) {
97 cached_prefs_->Set(key, std::move(value)); 97 cached_prefs_->Set(key, std::move(value));
98 changed = true; 98 changed = true;
99 } 99 }
100 } else { 100 } else {
101 cached_prefs_->Set(key, std::move(value)); 101 cached_prefs_->Set(key, std::move(value));
102 changed = true; 102 changed = true;
103 } 103 }
104 } 104 }
105 if (changed) 105 if (changed && initialized_)
106 ReportPrefValueChanged(key); 106 ReportPrefValueChanged(key);
107 } 107 }
108 108
109 template <typename BasePrefStore> 109 template <typename BasePrefStore>
110 void PrefStoreClientMixin<BasePrefStore>::OnInitializationCompleted( 110 void PrefStoreClientMixin<BasePrefStore>::OnInitializationCompleted(
111 bool succeeded) { 111 bool succeeded) {
112 if (!initialized_) { 112 if (!initialized_) {
113 initialized_ = true; 113 initialized_ = true;
114 for (auto& observer : observers_) 114 for (auto& observer : observers_)
115 observer.OnInitializationCompleted(succeeded); 115 observer.OnInitializationCompleted(succeeded);
116 } 116 }
117 } 117 }
118 118
119 template class PrefStoreClientMixin<::PrefStore>; 119 template class PrefStoreClientMixin<::PrefStore>;
120 template class PrefStoreClientMixin<::PersistentPrefStore>; 120 template class PrefStoreClientMixin<::PersistentPrefStore>;
121 121
122 } // namespace prefs 122 } // namespace prefs
OLDNEW
« no previous file with comments | « services/preferences/pref_store_manager_impl.cc ('k') | services/preferences/public/cpp/pref_store_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698