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

Side by Side Diff: chrome/browser/prefs/pref_value_store.cc

Issue 7661009: base: Add Is* functions to Value class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tony review Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 bool PrefValueStore::GetValue(const std::string& name, 110 bool PrefValueStore::GetValue(const std::string& name,
111 base::Value::Type 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)->GetType() != 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()
122 << " in store " << i; 122 << " in store " << i;
123 continue; 123 continue;
124 } 124 }
125 return true; 125 return true;
126 } 126 }
127 } 127 }
128 return false; 128 return false;
129 } 129 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_service_uitest.cc ('k') | chrome/browser/printing/cloud_print/cloud_print_setup_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698