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

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

Issue 10821047: Provide access to recommended pref values (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_value_store.h ('k') | chrome/browser/prefs/pref_value_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_value_store.cc
diff --git a/chrome/browser/prefs/pref_value_store.cc b/chrome/browser/prefs/pref_value_store.cc
index 8d59f4e52505854dff94849f63a080b5796752f3..0dda7dc045a842021bdc495645559c5b73a745f1 100644
--- a/chrome/browser/prefs/pref_value_store.cc
+++ b/chrome/browser/prefs/pref_value_store.cc
@@ -118,6 +118,20 @@ bool PrefValueStore::GetValue(const std::string& name,
return false;
}
+bool PrefValueStore::GetRecommendedValue(const std::string& name,
+ base::Value::Type type,
+ const Value** out_value) const {
+ *out_value = NULL;
+ if (!GetValueFromStore(name.c_str(), RECOMMENDED_STORE, out_value))
+ return false;
+ if (!(*out_value)->IsType(type)) {
+ LOG(WARNING) << "Expected type for " << name << " is " << type
+ << " but got " << (*out_value)->GetType();
+ return false;
+ }
Mattias Nissler (ping if slow) 2012/07/27 07:26:11 indentation
bartfab (slow) 2012/07/27 12:14:49 Done.
+ return true;
Mattias Nissler (ping if slow) 2012/07/27 07:26:11 seems like the code in this function is essentiall
bartfab (slow) 2012/07/27 12:14:49 Done.
+}
+
void PrefValueStore::NotifyPrefChanged(
const char* path,
PrefValueStore::PrefStoreType new_store) {
@@ -130,6 +144,10 @@ void PrefValueStore::NotifyPrefChanged(
pref_notifier_->OnPreferenceChanged(path);
if (pref_sync_associator_)
pref_sync_associator_->ProcessPrefChange(path);
+ // Always fire a notification when the recommended value changes, even if the
+ // effective value is unchanged.
Mattias Nissler (ping if slow) 2012/07/27 07:26:11 As discussed offline, maybe we want to just drop a
bartfab (slow) 2012/07/27 12:14:49 Fresh profile: Start browser, visit google.com, sh
+ } else if (new_store == RECOMMENDED_STORE) {
+ pref_notifier_->OnPreferenceChanged(path);
}
}
« no previous file with comments | « chrome/browser/prefs/pref_value_store.h ('k') | chrome/browser/prefs/pref_value_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698