Index: chrome/browser/ui/sync/one_click_signin_sync_starter.cc |
diff --git a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc |
index dc1b99838f723cee569fc91ca919e0446c5ea41f..fb42f38847b635e8bfc9f0e62da33ab0a8c71725 100644 |
--- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc |
+++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc |
@@ -220,9 +220,7 @@ void OneClickSigninSyncStarter::CompleteSigninForNewProfile( |
// Copy credentials from the old profile to the just-created profile, |
// and switch over to tracking that profile. |
new_signin_manager->CopyCredentialsFrom(*old_signin_manager); |
- ProfileSyncService* profile_sync_service = GetProfileSyncService(); |
- if (profile_sync_service) |
- profile_sync_service->SetSetupInProgress(false); |
+ FinishProfileSyncServiceSetup(); |
Initialize(new_profile, NULL); |
DCHECK_EQ(profile_, new_profile); |
@@ -273,9 +271,7 @@ void OneClickSigninSyncStarter::UntrustedSigninConfirmed( |
void OneClickSigninSyncStarter::SigninFailed( |
const GoogleServiceAuthError& error) { |
- ProfileSyncService* profile_sync_service = GetProfileSyncService(); |
- if (profile_sync_service) |
- profile_sync_service->SetSetupInProgress(false); |
+ FinishProfileSyncServiceSetup(); |
if (confirmation_required_ == CONFIRM_AFTER_SIGNIN) { |
switch (error.state()) { |
case GoogleServiceAuthError::SERVICE_UNAVAILABLE: |
@@ -303,8 +299,8 @@ void OneClickSigninSyncStarter::SigninSuccess() { |
profile_sync_service->OnUserChoseDatatypes(true, |
syncer::ModelTypeSet()); |
profile_sync_service->SetSyncSetupCompleted(); |
- profile_sync_service->SetSetupInProgress(false); |
} |
+ FinishProfileSyncServiceSetup(); |
if (confirmation_required_ == CONFIRM_AFTER_SIGNIN) { |
string16 message; |
if (!profile_sync_service) { |
@@ -369,6 +365,7 @@ void OneClickSigninSyncStarter::ConfigureSync() { |
} |
} else { |
// Sync is disabled - just display the settings page. |
+ FinishProfileSyncServiceSetup(); |
chrome::ShowSettings(browser_); |
} |
} |
@@ -381,6 +378,13 @@ ProfileSyncService* OneClickSigninSyncStarter::GetProfileSyncService() { |
return service; |
} |
+void OneClickSigninSyncStarter::FinishProfileSyncServiceSetup() { |
+ ProfileSyncService* service = |
+ ProfileSyncServiceFactory::GetForProfile(profile_); |
+ if (service) |
+ service->SetSetupInProgress(false); |
+} |
+ |
void OneClickSigninSyncStarter::ShowSyncSettingsPageOnSameTab() { |
std::string url = std::string(chrome::kChromeUISettingsURL) + |
chrome::kSyncSetupSubPage; |