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

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

Issue 2142123002: [Autofill] Run autofill-profile de-dupe after sync starts if sync is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better logging and fix mathp's comments Created 4 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: components/autofill/core/browser/webdata/autofill_webdata_backend_impl.cc
diff --git a/components/autofill/core/browser/webdata/autofill_webdata_backend_impl.cc b/components/autofill/core/browser/webdata/autofill_webdata_backend_impl.cc
index 2ebc31be5df38f15b723c14de7c88a98c10c6e58..1bc55bbda26e4d0c8a7129b59e3e1800eb69d769 100644
--- a/components/autofill/core/browser/webdata/autofill_webdata_backend_impl.cc
+++ b/components/autofill/core/browser/webdata/autofill_webdata_backend_impl.cc
@@ -29,13 +29,15 @@ AutofillWebDataBackendImpl::AutofillWebDataBackendImpl(
scoped_refptr<WebDatabaseBackend> web_database_backend,
scoped_refptr<base::SingleThreadTaskRunner> ui_thread,
scoped_refptr<base::SingleThreadTaskRunner> db_thread,
- const base::Closure& on_changed_callback)
+ const base::Closure& on_changed_callback,
+ const base::Callback<void(syncer::ModelType)>& on_sync_started_callback)
: base::RefCountedDeleteOnMessageLoop<AutofillWebDataBackendImpl>(
db_thread),
ui_thread_(ui_thread),
db_thread_(db_thread),
web_database_backend_(web_database_backend),
- on_changed_callback_(on_changed_callback) {
+ on_changed_callback_(on_changed_callback),
+ on_sync_started_callback_(on_sync_started_callback) {
}
void AutofillWebDataBackendImpl::AddObserver(
@@ -76,6 +78,18 @@ void AutofillWebDataBackendImpl::NotifyOfMultipleAutofillChanges() {
ui_thread_->PostTask(FROM_HERE, on_changed_callback_);
}
+void AutofillWebDataBackendImpl::NotifyThatSyncHasStarted(
+ syncer::ModelType model_type) {
+ DCHECK(db_thread_->BelongsToCurrentThread());
+
+ if (on_sync_started_callback_.is_null())
+ return;
+
+ // UI thread notification.
+ ui_thread_->PostTask(FROM_HERE,
+ base::Bind(on_sync_started_callback_, model_type));
+}
+
base::SupportsUserData* AutofillWebDataBackendImpl::GetDBUserData() {
DCHECK(db_thread_->BelongsToCurrentThread());
if (!user_data_)

Powered by Google App Engine
This is Rietveld 408576698