OLD | NEW |
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 "base/prefs/pref_value_store.h" | 5 #include "base/prefs/pref_value_store.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/prefs/pref_notifier.h" | 8 #include "base/prefs/pref_notifier.h" |
9 #include "base/prefs/pref_observer.h" | 9 #include "base/prefs/pref_observer.h" |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Check the |PrefStore|s in order of their priority from highest to lowest, | 109 // Check the |PrefStore|s in order of their priority from highest to lowest, |
110 // looking for the first preference value with the given |name| and |type|. | 110 // looking for the first preference value with the given |name| and |type|. |
111 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { | 111 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { |
112 if (GetValueFromStoreWithType(name.c_str(), type, | 112 if (GetValueFromStoreWithType(name.c_str(), type, |
113 static_cast<PrefStoreType>(i), out_value)) | 113 static_cast<PrefStoreType>(i), out_value)) |
114 return true; | 114 return true; |
115 } | 115 } |
116 return false; | 116 return false; |
117 } | 117 } |
118 | 118 |
| 119 bool PrefValueStore::GetUserValue(const std::string& name, |
| 120 base::Value::Type type, |
| 121 const base::Value** out_value) const { |
| 122 return GetValueFromStoreWithType(name.c_str(), type, USER_STORE, out_value); |
| 123 } |
| 124 |
119 bool PrefValueStore::GetRecommendedValue(const std::string& name, | 125 bool PrefValueStore::GetRecommendedValue(const std::string& name, |
120 base::Value::Type type, | 126 base::Value::Type type, |
121 const base::Value** out_value) const { | 127 const base::Value** out_value) const { |
122 return GetValueFromStoreWithType(name.c_str(), type, RECOMMENDED_STORE, | 128 return GetValueFromStoreWithType(name.c_str(), type, RECOMMENDED_STORE, |
123 out_value); | 129 out_value); |
124 } | 130 } |
125 | 131 |
126 void PrefValueStore::NotifyPrefChanged( | 132 void PrefValueStore::NotifyPrefChanged( |
127 const char* path, | 133 const char* path, |
128 PrefValueStore::PrefStoreType new_store) { | 134 PrefValueStore::PrefStoreType new_store) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 if (initialization_failed_) | 279 if (initialization_failed_) |
274 return; | 280 return; |
275 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { | 281 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { |
276 scoped_refptr<PrefStore> store = | 282 scoped_refptr<PrefStore> store = |
277 GetPrefStore(static_cast<PrefStoreType>(i)); | 283 GetPrefStore(static_cast<PrefStoreType>(i)); |
278 if (store.get() && !store->IsInitializationComplete()) | 284 if (store.get() && !store->IsInitializationComplete()) |
279 return; | 285 return; |
280 } | 286 } |
281 pref_notifier_->OnInitializationCompleted(true); | 287 pref_notifier_->OnInitializationCompleted(true); |
282 } | 288 } |
OLD | NEW |