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

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: Created 4 years, 6 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..9b7e9987f2159ee32ee6d9d8b931b3dcbfe53db1 100644
--- a/components/syncable_prefs/pref_model_associator.cc
+++ b/components/syncable_prefs/pref_model_associator.cc
@@ -157,6 +157,11 @@ void PrefModelAssociator::InitPrefAndAssociate(
// we'll send the new user controlled value to the syncer.
}
+void PrefModelAssociator::RegisterMergeDataFinishedCallback(
raymes 2016/06/29 03:50:01 Did you look into whether we should use PrefServic
lshang 2016/06/30 05:03:36 PrefServiceSyncableObserver will get called in Mer
+ const base::Closure& callback) {
+ callback_list_.push_back(callback);
raymes 2016/06/29 03:50:01 We should make sure that we only add this if we ex
lshang 2016/06/30 05:03:36 Done.
+}
+
syncer::SyncMergeResult PrefModelAssociator::MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
@@ -207,6 +212,10 @@ syncer::SyncMergeResult PrefModelAssociator::MergeDataAndStartSyncing(
InitPrefAndAssociate(syncer::SyncData(), *pref_name_iter, &new_changes);
}
+ for (const auto& callback : callback_list_)
+ callback.Run();
+ callback_list_.clear();
+
// Push updates to sync.
merge_result.set_error(
sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes));

Powered by Google App Engine
This is Rietveld 408576698