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

Unified Diff: components/syncable_prefs/pref_model_associator.cc

Issue 2078893002: Add callback list to PrefModelAssociator after sync data is loaded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@migrate_domain_scoped_settings
Patch Set: minor change 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/syncable_prefs/pref_model_associator.cc
diff --git a/components/syncable_prefs/pref_model_associator.cc b/components/syncable_prefs/pref_model_associator.cc
index 4cbdd558881022f6e5abb32c4cd5e53da6e8baf8..dd9d71494251ac0ed3fc456a9a1fd2f213a98f31 100644
--- a/components/syncable_prefs/pref_model_associator.cc
+++ b/components/syncable_prefs/pref_model_associator.cc
@@ -157,6 +157,14 @@ void PrefModelAssociator::InitPrefAndAssociate(
// we'll send the new user controlled value to the syncer.
}
+void PrefModelAssociator::RegisterMergeDataFinishedCallback(
+ const base::Closure& callback) {
+ if (!models_associated_)
+ callback_list_.push_back(callback);
+ else
+ callback.Run();
+}
+
syncer::SyncMergeResult PrefModelAssociator::MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
@@ -213,6 +221,10 @@ syncer::SyncMergeResult PrefModelAssociator::MergeDataAndStartSyncing(
if (merge_result.error().IsSet())
return merge_result;
+ for (const auto& callback : callback_list_)
+ callback.Run();
+ callback_list_.clear();
+
models_associated_ = true;
pref_service_->OnIsSyncingChanged();
return merge_result;
« no previous file with comments | « components/syncable_prefs/pref_model_associator.h ('k') | components/syncable_prefs/pref_service_syncable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698