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

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

Issue 444763005: Clear a preference when sync tries to delete a preference (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_model_associator.cc
diff --git a/chrome/browser/prefs/pref_model_associator.cc b/chrome/browser/prefs/pref_model_associator.cc
index bcf87eae3940054d6e437bfa7e327325cb99a16c..5057e361ed465d8660450d31f7f635ddea8b5272 100644
--- a/chrome/browser/prefs/pref_model_associator.cc
+++ b/chrome/browser/prefs/pref_model_associator.cc
@@ -478,19 +478,14 @@ syncer::SyncError PrefModelAssociator::ProcessSyncChanges(
scoped_ptr<base::Value> value(ReadPreferenceSpecifics(pref_specifics,
&name));
- if (iter->change_type() == syncer::SyncChange::ACTION_DELETE) {
- // We never delete preferences.
- NOTREACHED() << "Attempted to process sync delete change for " << name
- << ". Skipping.";
+ if (iter->change_type() != syncer::SyncChange::ACTION_DELETE &&
Nicolas Zea 2014/08/08 17:38:32 does the ACTION_DELETE condition still need to be
+ !value.get()) {
+ // Skip values we can't deserialize.
+ // TODO(zea): consider taking some further action such as erasing the bad
+ // data.
continue;
}
- // Skip values we can't deserialize.
- // TODO(zea): consider taking some further action such as erasing the bad
- // data.
- if (!value.get())
- continue;
-
// It is possible that we may receive a change to a preference we do not
// want to sync. For example if the user is syncing a Mac client and a
// Windows client, the Windows client does not support
@@ -513,7 +508,12 @@ syncer::SyncError PrefModelAssociator::ProcessSyncChanges(
// This will only modify the user controlled value store, which takes
// priority over the default value but is ignored if the preference is
// policy controlled.
- pref_service_->Set(pref_name, *value);
+ if (iter->change_type() != syncer::SyncChange::ACTION_DELETE) {
+ pref_service_->Set(pref_name, *value);
+ } else {
+ pref_service_->Set(pref_name,
+ *pref_service_->GetDefaultPrefValue(pref_name));
gab 2014/08/08 12:55:43 You should just do pref_service_->ClearPref(pref_n
Nicolas Zea 2014/08/08 17:38:32 Agreed. This will actually sync the default value
+ }
NotifySyncedPrefObservers(name, true /*from_sync*/);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698