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

Unified Diff: chrome/browser/prefs/pref_service.cc

Issue 10821047: Provide access to recommended pref values (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits addressed. Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/pref_service.h ('k') | chrome/browser/prefs/pref_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_service.cc
diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc
index fd1dc89a0af39978be5ec45569463e4f18371ffa..31ad5da8b0a15e8d3a28b08647c789d6bb10490c 100644
--- a/chrome/browser/prefs/pref_service.cc
+++ b/chrome/browser/prefs/pref_service.cc
@@ -995,6 +995,20 @@ const Value* PrefService::Preference::GetValue() const {
return NULL;
}
+const Value* PrefService::Preference::GetRecommendedValue() const {
+ DCHECK(pref_service_->FindPreference(name_.c_str())) <<
+ "Must register pref before getting its value";
+
+ const Value* found_value = NULL;
+ if (pref_value_store()->GetRecommendedValue(name_, type_, &found_value)) {
+ DCHECK(found_value->IsType(type_));
+ return found_value;
+ }
+
+ // The pref has no recommended value.
+ return NULL;
+}
+
bool PrefService::Preference::IsManaged() const {
return pref_value_store()->PrefValueInManagedStore(name_.c_str());
}
« no previous file with comments | « chrome/browser/prefs/pref_service.h ('k') | chrome/browser/prefs/pref_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698