OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |