Index: chrome/browser/sync/glue/sync_backend_host.cc |
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc |
index 07f331446a341db47ac6654995e8e020d8f467f0..dac917a76efc540913063290bf4671a4eaf72be6 100644 |
--- a/chrome/browser/sync/glue/sync_backend_host.cc |
+++ b/chrome/browser/sync/glue/sync_backend_host.cc |
@@ -86,7 +86,8 @@ class SyncBackendHost::Core |
const sessions::SyncSessionSnapshot& snapshot) OVERRIDE; |
virtual void OnInitializationComplete( |
const WeakHandle<JsBackend>& js_backend, |
- bool success) OVERRIDE; |
+ bool success, |
+ syncable::ModelTypeSet restored_types) OVERRIDE; |
virtual void OnConnectionStatusChange( |
sync_api::ConnectionStatus status) OVERRIDE; |
virtual void OnPassphraseRequired( |
@@ -339,7 +340,6 @@ void SyncBackendHost::Initialize( |
SyncFrontend* frontend, |
const WeakHandle<JsEventHandler>& event_handler, |
const GURL& sync_service_url, |
- syncable::ModelTypeSet initial_types, |
const SyncCredentials& credentials, |
bool delete_sync_data_folder, |
UnrecoverableErrorHandler* unrecoverable_error_handler, |
@@ -350,14 +350,7 @@ void SyncBackendHost::Initialize( |
frontend_ = frontend; |
DCHECK(frontend); |
- syncable::ModelTypeSet initial_types_with_nigori(initial_types); |
- CHECK(sync_prefs_.get()); |
- if (sync_prefs_->HasSyncSetupCompleted()) { |
- initial_types_with_nigori.Put(syncable::NIGORI); |
- } |
- |
- registrar_.reset(new SyncBackendRegistrar(initial_types_with_nigori, |
- name_, |
+ registrar_.reset(new SyncBackendRegistrar(name_, |
profile_, |
sync_thread_.message_loop())); |
ModelSafeRoutingInfo routing_info; |
@@ -769,7 +762,6 @@ void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() { |
SDVLOG(1) << "Syncer in config mode. SBH executing " |
<< "FinishConfigureDataTypesOnFrontendLoop"; |
- |
ModelSafeRoutingInfo routing_info; |
registrar_->GetModelSafeRoutingInfo(&routing_info); |
const syncable::ModelTypeSet enabled_types = |
@@ -779,21 +771,6 @@ void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() { |
// to happen on the UI thread. |
chrome_sync_notification_bridge_.UpdateEnabledTypes(enabled_types); |
- if (pending_config_mode_state_->added_types.Empty() && |
- !core_->sync_manager()->InitialSyncEndedTypes().HasAll(enabled_types)) { |
- |
- // TODO(tim): Log / UMA / count this somehow? |
- // Add only the types with empty progress markers. Note: it is possible |
- // that some types have their initial_sync_ended be false but with non |
- // empty progress marker. Which is ok as the rest of the changes would |
- // be downloaded on a regular nudge and initial_sync_ended should be set |
- // to true. However this is a very corner case. So it is not explicitly |
- // handled. |
- pending_config_mode_state_->added_types = |
- sync_api::GetTypesWithEmptyProgressMarkerToken(enabled_types, |
- GetUserShare()); |
- } |
- |
// If we've added types, we always want to request a nudge/config (even if |
// the initial sync is ended), in case we could not decrypt the data. |
if (pending_config_mode_state_->added_types.Empty()) { |
@@ -836,10 +813,6 @@ void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() { |
enabled_types)); |
} |
-bool SyncBackendHost::IsDownloadingNigoriForTest() const { |
- return initialization_state_ == DOWNLOADING_NIGORI; |
-} |
- |
SyncBackendHost::DoInitializeOptions::DoInitializeOptions( |
MessageLoop* sync_loop, |
SyncBackendRegistrar* registrar, |
@@ -916,12 +889,13 @@ void SyncBackendHost::Core::OnSyncCycleCompleted( |
void SyncBackendHost::Core::OnInitializationComplete( |
const WeakHandle<JsBackend>& js_backend, |
- bool success) { |
+ bool success, |
+ syncable::ModelTypeSet restored_types) { |
DCHECK_EQ(MessageLoop::current(), sync_loop_); |
host_.Call( |
FROM_HERE, |
- &SyncBackendHost::HandleInitializationCompletedOnFrontendLoop, |
- js_backend, success); |
+ &SyncBackendHost::HandleSyncManagerInitializationOnFrontendLoop, |
+ js_backend, success, restored_types); |
if (success) { |
// Initialization is complete, so we can schedule recurring SaveChanges. |
@@ -1102,7 +1076,6 @@ void SyncBackendHost::Core::DoInitialize(const DoInitializeOptions& options) { |
options.service_url.SchemeIsSecure(), |
BrowserThread::GetBlockingPool(), |
options.make_http_bridge_factory_fn.Run(), |
- options.routing_info, |
options.workers, |
options.extensions_activity_monitor, |
options.registrar /* as SyncManager::ChangeDelegate */, |
@@ -1289,14 +1262,6 @@ void SyncBackendHost::HandleInitializationCompletedOnFrontendLoop( |
return; |
} |
- // If setup has completed, start off in DOWNLOADING_NIGORI so that |
- // we start off by refreshing nigori. |
- CHECK(sync_prefs_.get()); |
- if (sync_prefs_->HasSyncSetupCompleted() && |
- initialization_state_ < DOWNLOADING_NIGORI) { |
- initialization_state_ = DOWNLOADING_NIGORI; |
- } |
- |
// Run initialization state machine. |
switch (initialization_state_) { |
case NOT_INITIALIZED: |
@@ -1450,6 +1415,13 @@ void SyncBackendHost::HandleNigoriConfigurationCompletedOnFrontendLoop( |
js_backend, failed_configuration_types.Empty()); |
} |
+void SyncBackendHost::HandleSyncManagerInitializationOnFrontendLoop( |
+ const WeakHandle<JsBackend>& js_backend, bool success, |
+ syncable::ModelTypeSet restored_types) { |
+ registrar_->SetInitialTypes(restored_types); |
+ HandleInitializationCompletedOnFrontendLoop(js_backend, success); |
+} |
+ |
namespace { |
// Needed because MessageLoop::PostTask is overloaded. |