| 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 {};
|
| }
|
|
|
|
|