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

Unified Diff: components/syncable_prefs/pref_model_associator.cc

Issue 1895993003: Add migration code to change existing domain scoped content settings to be origin scoped (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove logs and format 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..9e3d4722324050e6dbad476d3da12b1662e39acf 100644
--- a/components/syncable_prefs/pref_model_associator.cc
+++ b/components/syncable_prefs/pref_model_associator.cc
@@ -7,6 +7,8 @@
#include <utility>
#include "base/auto_reset.h"
+#include "base/bind.h"
+#include "base/callback.h"
#include "base/json/json_reader.h"
#include "base/json/json_string_value_serializer.h"
#include "base/location.h"
@@ -54,6 +56,8 @@ sync_pb::PreferenceSpecifics* GetMutableSpecifics(
} // namespace
+base::Closure syncable_prefs::PrefModelAssociator::migrate_call_back_;
+
PrefModelAssociator::PrefModelAssociator(
const PrefModelAssociatorClient* client,
syncer::ModelType type)
@@ -157,6 +161,17 @@ void PrefModelAssociator::InitPrefAndAssociate(
// we'll send the new user controlled value to the syncer.
}
+// static
+void PrefModelAssociator::SetMergeDataFinishedCallback(
+ const base::Closure& callback) {
+ migrate_call_back_ = callback;
+}
+
+// static
+void PrefModelAssociator::ResetMergeDataFinishedCallback() {
+ migrate_call_back_.Reset();
+}
+
syncer::SyncMergeResult PrefModelAssociator::MergeDataAndStartSyncing(
syncer::ModelType type,
const syncer::SyncDataList& initial_sync_data,
@@ -206,7 +221,9 @@ syncer::SyncMergeResult PrefModelAssociator::MergeDataAndStartSyncing(
++pref_name_iter) {
InitPrefAndAssociate(syncer::SyncData(), *pref_name_iter, &new_changes);
}
-
+ if (!migrate_call_back_.is_null()) {
+ migrate_call_back_.Run();
+ }
// Push updates to sync.
merge_result.set_error(
sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes));

Powered by Google App Engine
This is Rietveld 408576698