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

Unified Diff: chrome/browser/pref_value_store.cc

Issue 3051001: Adjust preference sync code to only sync user modifiable preferences. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: separate out the download_manager_unittest.cc fixes Created 10 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/pref_value_store.h ('k') | chrome/browser/sync/glue/preference_change_processor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/pref_value_store.cc
diff --git a/chrome/browser/pref_value_store.cc b/chrome/browser/pref_value_store.cc
index a5fae75cdb5d695a76f77110a82b89ce67dfb3fc..0988b9c2776cf39d5aad8b1fb0d44d924a960fe1 100644
--- a/chrome/browser/pref_value_store.cc
+++ b/chrome/browser/pref_value_store.cc
@@ -100,11 +100,16 @@ bool PrefValueStore::PrefValueInUserStore(const wchar_t* name) {
}
bool PrefValueStore::PrefValueFromExtensionStore(const wchar_t* name) {
- return PrefValueFromStore(name, EXTENSION);
+ return ControllingPrefStoreForPref(name) == EXTENSION;
}
bool PrefValueStore::PrefValueFromUserStore(const wchar_t* name) {
- return PrefValueFromStore(name, USER);
+ return ControllingPrefStoreForPref(name) == USER;
+}
+
+bool PrefValueStore::PrefValueUserModifiable(const wchar_t* name) {
+ PrefStoreType effective_store = ControllingPrefStoreForPref(name);
+ return effective_store >= USER || effective_store == INVALID;
}
bool PrefValueStore::PrefValueInStore(const wchar_t* name, PrefStoreType type) {
@@ -116,12 +121,11 @@ bool PrefValueStore::PrefValueInStore(const wchar_t* name, PrefStoreType type) {
return pref_stores_[type]->prefs()->Get(name, &tmp_value);
}
-bool PrefValueStore::PrefValueFromStore(const wchar_t* name,
- PrefStoreType type) {
- // No need to look in PrefStores with lower priority than the one we want.
- for (int i = 0; i <= type; ++i) {
+PrefValueStore::PrefStoreType PrefValueStore::ControllingPrefStoreForPref(
+ const wchar_t* name) {
+ for (int i = 0; i <= PREF_STORE_TYPE_MAX; ++i) {
if (PrefValueInStore(name, static_cast<PrefStoreType>(i)))
- return (i == type);
+ return static_cast<PrefStoreType>(i);
}
- return false;
+ return INVALID;
}
« no previous file with comments | « chrome/browser/pref_value_store.h ('k') | chrome/browser/sync/glue/preference_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698