Index: chrome/browser/prefs/pref_service.cc |
diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc |
index de7f406748f82fbffd323af8b631ca6d1d6b8253..ea1d705eac19c365f2940c65f9b3eead5ea9b2f9 100644 |
--- a/chrome/browser/prefs/pref_service.cc |
+++ b/chrome/browser/prefs/pref_service.cc |
@@ -684,6 +684,31 @@ const DictionaryValue* PrefService::GetDictionary(const char* path) const { |
return static_cast<const DictionaryValue*>(value); |
} |
+const base::Value* PrefService::GetUserPrefValue(const char* path) const { |
+ DCHECK(CalledOnValidThread()); |
+ |
+ const Preference* pref = FindPreference(path); |
+ if (!pref) { |
+ NOTREACHED() << "Trying to get an unregistered pref: " << path; |
+ return NULL; |
+ } |
+ |
+ // Look for an existing preference in the user store. If it doesn't |
+ // exist, return NULL. |
+ base::Value* value = NULL; |
+ if (user_pref_store_->GetMutableValue(path, &value) != |
+ PersistentPrefStore::READ_OK) { |
+ return NULL; |
+ } |
+ |
+ if (!value->IsType(pref->GetType())) { |
+ NOTREACHED() << "Pref value type doesn't match registered type."; |
+ return NULL; |
+ } |
+ |
+ return value; |
+} |
+ |
const ListValue* PrefService::GetList(const char* path) const { |
DCHECK(CalledOnValidThread()); |