| 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 "components/prefs/pref_value_store.h" | 5 #include "components/prefs/pref_value_store.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "components/prefs/pref_notifier.h" | 10 #include "components/prefs/pref_notifier.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 // Check the |PrefStore|s in order of their priority from highest to lowest, | 111 // Check the |PrefStore|s in order of their priority from highest to lowest, |
| 112 // looking for the first preference value with the given |name| and |type|. | 112 // looking for the first preference value with the given |name| and |type|. |
| 113 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { | 113 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { |
| 114 if (GetValueFromStoreWithType(name, type, static_cast<PrefStoreType>(i), | 114 if (GetValueFromStoreWithType(name, type, static_cast<PrefStoreType>(i), |
| 115 out_value)) | 115 out_value)) |
| 116 return true; | 116 return true; |
| 117 } | 117 } |
| 118 return false; | 118 return false; |
| 119 } | 119 } |
| 120 | 120 |
| 121 bool PrefValueStore::GetManagedValue(const std::string& name, |
| 122 base::Value::Type type, |
| 123 const base::Value** out_value) const { |
| 124 return GetValueFromStoreWithType(name, type, MANAGED_STORE, out_value); |
| 125 } |
| 126 |
| 121 bool PrefValueStore::GetRecommendedValue(const std::string& name, | 127 bool PrefValueStore::GetRecommendedValue(const std::string& name, |
| 122 base::Value::Type type, | 128 base::Value::Type type, |
| 123 const base::Value** out_value) const { | 129 const base::Value** out_value) const { |
| 124 return GetValueFromStoreWithType(name, type, RECOMMENDED_STORE, out_value); | 130 return GetValueFromStoreWithType(name, type, RECOMMENDED_STORE, out_value); |
| 125 } | 131 } |
| 126 | 132 |
| 127 void PrefValueStore::NotifyPrefChanged( | 133 void PrefValueStore::NotifyPrefChanged( |
| 128 const std::string& path, | 134 const std::string& path, |
| 129 PrefValueStore::PrefStoreType new_store) { | 135 PrefValueStore::PrefStoreType new_store) { |
| 130 DCHECK(new_store != INVALID_STORE); | 136 DCHECK(new_store != INVALID_STORE); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 if (initialization_failed_) | 287 if (initialization_failed_) |
| 282 return; | 288 return; |
| 283 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { | 289 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { |
| 284 scoped_refptr<PrefStore> store = | 290 scoped_refptr<PrefStore> store = |
| 285 GetPrefStore(static_cast<PrefStoreType>(i)); | 291 GetPrefStore(static_cast<PrefStoreType>(i)); |
| 286 if (store.get() && !store->IsInitializationComplete()) | 292 if (store.get() && !store->IsInitializationComplete()) |
| 287 return; | 293 return; |
| 288 } | 294 } |
| 289 pref_notifier_->OnInitializationCompleted(true); | 295 pref_notifier_->OnInitializationCompleted(true); |
| 290 } | 296 } |
| OLD | NEW |