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

Unified Diff: chrome/browser/sync/glue/preference_model_associator.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
Index: chrome/browser/sync/glue/preference_model_associator.cc
diff --git a/chrome/browser/sync/glue/preference_model_associator.cc b/chrome/browser/sync/glue/preference_model_associator.cc
index 89eb674e85ad6e2e80624fcbb25bb18b60250d93..5dad397ef44415b58878758ccb5ec6cbc08050f3 100644
--- a/chrome/browser/sync/glue/preference_model_associator.cc
+++ b/chrome/browser/sync/glue/preference_model_associator.cc
@@ -73,11 +73,12 @@ bool PreferenceModelAssociator::AssociateModels() {
sync_api::WriteNode node(&trans);
if (node.InitByClientTagLookup(syncable::PREFERENCES, tag)) {
+ // The server has a value for the preference.
const sync_pb::PreferenceSpecifics& preference(
node.GetPreferenceSpecifics());
DCHECK_EQ(tag, preference.name());
- if (!pref->IsManaged()) {
+ if (pref->IsUserModifiable()) {
scoped_ptr<Value> value(
reader.JsonToValue(preference.value(), false, false));
std::wstring pref_name = UTF8ToWide(preference.name());
@@ -104,12 +105,9 @@ bool PreferenceModelAssociator::AssociateModels() {
return false;
}
Associate(pref, node.GetId());
- } else if (!pref->IsManaged()) {
- // If there is no server value for this preference and it is
- // currently its default value, don't create a new server node.
- if (pref->IsDefaultValue())
- continue;
-
+ } else if (pref->IsUserControlled()) {
+ // The server doesn't have a value, but we have a user-controlled value,
+ // so we push it to the server.
sync_api::WriteNode write_node(&trans);
if (!write_node.InitUniqueByCreation(syncable::PREFERENCES, root, tag)) {
LOG(ERROR) << "Failed to create preference sync node.";

Powered by Google App Engine
This is Rietveld 408576698