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

Unified Diff: components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc

Issue 2652393003: [Sync] MergeSyncData implementation for Autocomplete. (Closed)
Patch Set: Created 3 years, 11 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 | components/autofill/core/browser/webdata/autocomplete_sync_bridge_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc
diff --git a/components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc b/components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc
index 0bf47d314ba2ab9ea4a087443d69be3858b8fc3f..c5ce09b1a3cfff9dc4b994f15de04f3bd11c316a 100644
--- a/components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc
+++ b/components/autofill/core/browser/webdata/autocomplete_sync_bridge.cc
@@ -143,17 +143,19 @@ class SyncDifferenceTracker {
return ModelError(FROM_HERE, "Failed reading from WebDatabase.");
} else if (!local) {
save_to_local_.push_back(remote);
- } else if (remote != local.value()) {
- if (specifics.usage_timestamp().empty()) {
- // Skip merging if there are no timestamps. We don't want to wipe out
- // a local value of |date_created| if the remote copy is oddly formed.
- save_to_sync_.push_back(local.value());
- } else {
- const AutofillEntry merged = MergeEntryDates(local.value(), remote);
- save_to_local_.push_back(merged);
- save_to_sync_.push_back(merged);
- }
+ } else {
unique_to_local_.erase(local.value());
+ if (remote != local.value()) {
+ if (specifics.usage_timestamp().empty()) {
+ // Skip merging if there are no timestamps. We don't want to wipe out
+ // a local value of |date_created| if the remote copy is oddly formed.
+ save_to_sync_.push_back(local.value());
+ } else {
+ const AutofillEntry merged = MergeEntryDates(local.value(), remote);
+ save_to_local_.push_back(merged);
+ save_to_sync_.push_back(merged);
+ }
+ }
}
return {};
}
@@ -318,8 +320,7 @@ Optional<syncer::ModelError> AutocompleteSyncBridge::MergeSyncData(
EntityDataMap entity_data_map) {
DCHECK(thread_checker_.CalledOnValidThread());
- // TODO(skym, crbug.com/680218): Uncomment and add unit tests.
- /*SyncDifferenceTracker tracker(GetAutofillTable());
+ SyncDifferenceTracker tracker(GetAutofillTable());
for (auto kv : entity_data_map) {
DCHECK(kv.second->specifics.has_autofill());
RETURN_IF_ERROR(tracker.IncorporateRemoteSpecifics(
@@ -330,7 +331,7 @@ Optional<syncer::ModelError> AutocompleteSyncBridge::MergeSyncData(
RETURN_IF_ERROR(tracker.FlushToSync(true, std::move(metadata_change_list),
change_processor()));
web_data_backend_->RemoveExpiredFormElements();
- web_data_backend_->NotifyThatSyncHasStarted(syncer::AUTOFILL);*/
+ web_data_backend_->NotifyThatSyncHasStarted(syncer::AUTOFILL);
return {};
}
« no previous file with comments | « no previous file | components/autofill/core/browser/webdata/autocomplete_sync_bridge_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698