| Index: components/browser_sync/browser/profile_sync_service.cc | 
| diff --git a/components/browser_sync/browser/profile_sync_service.cc b/components/browser_sync/browser/profile_sync_service.cc | 
| index 9adcba94c1fce13b15c559d6ade4464a3d1a0eb5..f24df73a3587d31b1fa39bfd0641858035982980 100644 | 
| --- a/components/browser_sync/browser/profile_sync_service.cc | 
| +++ b/components/browser_sync/browser/profile_sync_service.cc | 
| @@ -211,7 +211,6 @@ | 
| connection_status_(syncer::CONNECTION_NOT_ATTEMPTED), | 
| last_get_token_error_(GoogleServiceAuthError::AuthErrorNone()), | 
| network_resources_(new syncer::HttpBridgeNetworkResources), | 
| -      start_behavior_(start_behavior), | 
| backend_mode_(IDLE), | 
| need_backup_(false), | 
| backup_finished_(false), | 
| @@ -221,49 +220,23 @@ | 
| startup_controller_weak_factory_(this) { | 
| DCHECK(thread_checker_.CalledOnValidThread()); | 
| DCHECK(sync_client_); | 
| -  std::string last_version = sync_prefs_.GetLastRunVersion(); | 
| -  std::string current_version = PRODUCT_VERSION; | 
| -  sync_prefs_.SetLastRunVersion(current_version); | 
| - | 
| -  // Check for a major version change. Note that the versions have format | 
| -  // MAJOR.MINOR.BUILD.PATCH. | 
| -  if (last_version.substr(0, last_version.find('.')) != | 
| -      current_version.substr(0, current_version.find('.'))) { | 
| -    passphrase_prompt_triggered_by_version_ = true; | 
| -  } | 
| -} | 
| - | 
| -ProfileSyncService::~ProfileSyncService() { | 
| -  sync_prefs_.RemoveSyncPrefObserver(this); | 
| -  // Shutdown() should have been called before destruction. | 
| -  CHECK(!backend_initialized_); | 
| -} | 
| - | 
| -bool ProfileSyncService::CanSyncStart() const { | 
| -  return IsSyncAllowed() && IsSyncRequested() && IsSignedIn(); | 
| -} | 
| - | 
| -bool ProfileSyncService::IsOAuthRefreshTokenAvailable() { | 
| -  if (!oauth2_token_service_) | 
| -    return false; | 
| - | 
| -  return oauth2_token_service_->RefreshTokenIsAvailable( | 
| -      signin_->GetAccountIdToUse()); | 
| -} | 
| - | 
| -void ProfileSyncService::Initialize() { | 
| -  sync_client_->Initialize(this); | 
| - | 
| startup_controller_.reset(new browser_sync::StartupController( | 
| -      start_behavior_, oauth2_token_service_, &sync_prefs_, signin_.get(), | 
| +      start_behavior, | 
| +      oauth2_token_service, | 
| +      &sync_prefs_, | 
| +      signin_.get(), | 
| base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, | 
| -                 startup_controller_weak_factory_.GetWeakPtr(), SYNC))); | 
| +                 startup_controller_weak_factory_.GetWeakPtr(), | 
| +                 SYNC))); | 
| backup_rollback_controller_.reset(new sync_driver::BackupRollbackController( | 
| -      &sync_prefs_, signin_.get(), | 
| +      &sync_prefs_, | 
| +      signin_.get(), | 
| base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, | 
| -                 startup_controller_weak_factory_.GetWeakPtr(), BACKUP), | 
| +                 startup_controller_weak_factory_.GetWeakPtr(), | 
| +                 BACKUP), | 
| base::Bind(&ProfileSyncService::StartUpSlowBackendComponents, | 
| -                 startup_controller_weak_factory_.GetWeakPtr(), ROLLBACK))); | 
| +                 startup_controller_weak_factory_.GetWeakPtr(), | 
| +                 ROLLBACK))); | 
| scoped_ptr<browser_sync::LocalSessionEventRouter> router( | 
| sync_client_->GetSyncSessionsClient()->GetLocalSessionEventRouter()); | 
| local_device_ = sync_client_->GetSyncApiComponentFactory() | 
| @@ -283,11 +256,38 @@ | 
| device_info_sync_service_.reset( | 
| new DeviceInfoSyncService(local_device_.get())); | 
|  | 
| -  sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod | 
| -      register_platform_types_callback = | 
| -          sync_client_->GetRegisterPlatformTypesCallback(); | 
| -  sync_client_->GetSyncApiComponentFactory()->RegisterDataTypes( | 
| -      register_platform_types_callback); | 
| +  std::string last_version = sync_prefs_.GetLastRunVersion(); | 
| +  std::string current_version = PRODUCT_VERSION; | 
| +  sync_prefs_.SetLastRunVersion(current_version); | 
| + | 
| +  // Check for a major version change. Note that the versions have format | 
| +  // MAJOR.MINOR.BUILD.PATCH. | 
| +  if (last_version.substr(0, last_version.find('.')) != | 
| +      current_version.substr(0, current_version.find('.'))) { | 
| +    passphrase_prompt_triggered_by_version_ = true; | 
| +  } | 
| +} | 
| + | 
| +ProfileSyncService::~ProfileSyncService() { | 
| +  sync_prefs_.RemoveSyncPrefObserver(this); | 
| +  // Shutdown() should have been called before destruction. | 
| +  CHECK(!backend_initialized_); | 
| +} | 
| + | 
| +bool ProfileSyncService::CanSyncStart() const { | 
| +  return IsSyncAllowed() && IsSyncRequested() && IsSignedIn(); | 
| +} | 
| + | 
| +bool ProfileSyncService::IsOAuthRefreshTokenAvailable() { | 
| +  if (!oauth2_token_service_) | 
| +    return false; | 
| + | 
| +  return oauth2_token_service_->RefreshTokenIsAvailable( | 
| +      signin_->GetAccountIdToUse()); | 
| +} | 
| + | 
| +void ProfileSyncService::Initialize() { | 
| +  sync_client_->Initialize(this); | 
|  | 
| // We clear this here (vs Shutdown) because we want to remember that an error | 
| // happened on shutdown so we can display details (message, location) about it | 
| @@ -672,8 +672,8 @@ | 
|  | 
| backend_.reset( | 
| sync_client_->GetSyncApiComponentFactory()->CreateSyncBackendHost( | 
| -          debug_identifier_, invalidator, sync_prefs_.AsWeakPtr(), | 
| -          directory_path_)); | 
| +          debug_identifier_, sync_client_.get(), invalidator, | 
| +          sync_prefs_.AsWeakPtr(), directory_path_)); | 
|  | 
| // Initialize the backend.  Every time we start up a new SyncBackendHost, | 
| // we'll want to start from a fresh SyncDB, so delete any old one that might | 
|  |