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 295df44c0f37e40ffe93e4836a0d82d6b217959e..3be7fc576c964ca46d4f5438baeb0ddc1fb4507d 100644 |
--- a/chrome/browser/ui/sync/one_click_signin_sync_starter.cc |
+++ b/chrome/browser/ui/sync/one_click_signin_sync_starter.cc |
@@ -18,29 +18,30 @@ |
#include "chrome/common/url_constants.h" |
OneClickSigninSyncStarter::OneClickSigninSyncStarter( |
+ Profile* profile, |
Browser* browser, |
const std::string& session_index, |
const std::string& email, |
const std::string& password, |
StartSyncMode start_mode) |
- : browser_(browser), |
- signin_tracker_(browser_->profile(), this), |
+ : profile_(profile), |
+ browser_(browser), |
+ signin_tracker_(profile_, this), |
start_mode_(start_mode) { |
- DCHECK(browser_); |
+ DCHECK(profile_); |
// Let the sync service know that setup is in progress so it doesn't start |
// syncing until the user has finished any configuration. |
ProfileSyncService* profile_sync_service = |
- ProfileSyncServiceFactory::GetForProfile(browser_->profile()); |
+ ProfileSyncServiceFactory::GetForProfile(profile_); |
profile_sync_service->SetSetupInProgress(true); |
// Make sure the syncing is not suppressed, otherwise the SigninManager |
// will not be able to compelte sucessfully. |
- browser_sync::SyncPrefs sync_prefs(browser_->profile()->GetPrefs()); |
+ browser_sync::SyncPrefs sync_prefs(profile_->GetPrefs()); |
sync_prefs.SetStartSuppressed(false); |
- SigninManager* manager = SigninManagerFactory::GetForProfile( |
- browser_->profile()); |
+ SigninManager* manager = SigninManagerFactory::GetForProfile(profile_); |
manager->StartSignInWithCredentials(session_index, email, password); |
} |
@@ -53,14 +54,14 @@ void OneClickSigninSyncStarter::GaiaCredentialsValid() { |
void OneClickSigninSyncStarter::SigninFailed( |
const GoogleServiceAuthError& error) { |
ProfileSyncService* profile_sync_service = |
- ProfileSyncServiceFactory::GetForProfile(browser_->profile()); |
+ ProfileSyncServiceFactory::GetForProfile(profile_); |
profile_sync_service->SetSetupInProgress(false); |
delete this; |
} |
void OneClickSigninSyncStarter::SigninSuccess() { |
ProfileSyncService* profile_sync_service = |
- ProfileSyncServiceFactory::GetForProfile(browser_->profile()); |
+ ProfileSyncServiceFactory::GetForProfile(profile_); |
switch (start_mode_) { |
case SYNC_WITH_DEFAULT_SETTINGS: |
@@ -74,11 +75,10 @@ void OneClickSigninSyncStarter::SigninSuccess() { |
// ProfileSyncService::setup_in_progress flag because we don't want sync |
// to start up until after the configure UI is displayed (the configure UI |
// will clear the flag when the user is done setting up sync). |
- LoginUIService* login_ui = LoginUIServiceFactory::GetForProfile( |
- browser_->profile()); |
+ LoginUIService* login_ui = LoginUIServiceFactory::GetForProfile(profile_); |
if (login_ui->current_login_ui()) { |
login_ui->current_login_ui()->FocusUI(); |
- } else { |
+ } else if (browser_) { |
// Need to navigate to the settings page and display the UI. |
chrome::ShowSettingsSubPage(browser_, chrome::kSyncSetupSubPage); |
} |