OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/prefs/pref_value_store.h" | 5 #include "chrome/browser/prefs/pref_value_store.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/prefs/pref_model_associator.h" | 8 #include "chrome/browser/prefs/pref_model_associator.h" |
9 #include "chrome/browser/prefs/pref_notifier.h" | 9 #include "chrome/browser/prefs/pref_notifier.h" |
10 | 10 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 default_prefs = GetPrefStore(DEFAULT_STORE); | 101 default_prefs = GetPrefStore(DEFAULT_STORE); |
102 | 102 |
103 return new PrefValueStore( | 103 return new PrefValueStore( |
104 managed_platform_prefs, managed_cloud_prefs, extension_prefs, | 104 managed_platform_prefs, managed_cloud_prefs, extension_prefs, |
105 command_line_prefs, user_prefs, recommended_platform_prefs, | 105 command_line_prefs, user_prefs, recommended_platform_prefs, |
106 recommended_cloud_prefs, default_prefs, pref_sync_associator, | 106 recommended_cloud_prefs, default_prefs, pref_sync_associator, |
107 pref_notifier); | 107 pref_notifier); |
108 } | 108 } |
109 | 109 |
110 bool PrefValueStore::GetValue(const std::string& name, | 110 bool PrefValueStore::GetValue(const std::string& name, |
111 Value::ValueType type, | 111 base::Value::Type type, |
112 const Value** out_value) const { | 112 const Value** out_value) const { |
113 *out_value = NULL; | 113 *out_value = NULL; |
114 // Check the |PrefStore|s in order of their priority from highest to lowest | 114 // Check the |PrefStore|s in order of their priority from highest to lowest |
115 // to find the value of the preference described by the given preference name. | 115 // to find the value of the preference described by the given preference name. |
116 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { | 116 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { |
117 if (GetValueFromStore(name.c_str(), static_cast<PrefStoreType>(i), | 117 if (GetValueFromStore(name.c_str(), static_cast<PrefStoreType>(i), |
118 out_value)) { | 118 out_value)) { |
119 if (!(*out_value)->IsType(type)) { | 119 if (!(*out_value)->IsType(type)) { |
120 LOG(WARNING) << "Expected type for " << name << " is " << type | 120 LOG(WARNING) << "Expected type for " << name << " is " << type |
121 << " but got " << (*out_value)->GetType() | 121 << " but got " << (*out_value)->GetType() |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 if (initialization_failed_) | 268 if (initialization_failed_) |
269 return; | 269 return; |
270 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { | 270 for (size_t i = 0; i <= PREF_STORE_TYPE_MAX; ++i) { |
271 scoped_refptr<PrefStore> store = | 271 scoped_refptr<PrefStore> store = |
272 GetPrefStore(static_cast<PrefStoreType>(i)); | 272 GetPrefStore(static_cast<PrefStoreType>(i)); |
273 if (store && !store->IsInitializationComplete()) | 273 if (store && !store->IsInitializationComplete()) |
274 return; | 274 return; |
275 } | 275 } |
276 pref_notifier_->OnInitializationCompleted(true); | 276 pref_notifier_->OnInitializationCompleted(true); |
277 } | 277 } |
OLD | NEW |