| Index: chrome/browser/ui/webui/inline_login_ui.cc
|
| diff --git a/chrome/browser/ui/webui/inline_login_ui.cc b/chrome/browser/ui/webui/inline_login_ui.cc
|
| index 4ee7cb7824a7cc07bf1d56f368f5379886c47924..5a8d095fd6543877d5af8f7e49be60e7f0aaf61f 100644
|
| --- a/chrome/browser/ui/webui/inline_login_ui.cc
|
| +++ b/chrome/browser/ui/webui/inline_login_ui.cc
|
| @@ -300,16 +300,28 @@ class InlineLoginUIHandler : public GaiaAuthConsumer,
|
| choose_what_to_sync_?
|
| OneClickSigninSyncStarter::NO_CONFIRMATION :
|
| OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN;
|
| - // Call OneClickSigninSyncStarter to exchange oauth code for tokens.
|
| - // OneClickSigninSyncStarter will delete itself once the job is done.
|
| - new OneClickSigninSyncStarter(
|
| - profile_, NULL, "" /* session_index, not used */,
|
| - email_, password_, oauth_code,
|
| - start_mode,
|
| - contents,
|
| - confirmation_required,
|
| - base::Bind(&InlineLoginUIHandler::SyncStarterCallback,
|
| - weak_factory_.GetWeakPtr()));
|
| + OneClickSigninSyncStarter::Callback sync_callback = base::Bind(
|
| + &InlineLoginUIHandler::SyncStarterCallback,
|
| + weak_factory_.GetWeakPtr());
|
| +
|
| + bool cross_account_error_handled =
|
| + OneClickSigninHelper::HandleCrossAccountError(
|
| + contents, "" /* session_index, not used */,
|
| + email_, password_, oauth_code,
|
| + OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT,
|
| + source, start_mode, sync_callback);
|
| +
|
| + if (!cross_account_error_handled) {
|
| + // Call OneClickSigninSyncStarter to exchange oauth code for tokens.
|
| + // OneClickSigninSyncStarter will delete itself once the job is done.
|
| + new OneClickSigninSyncStarter(
|
| + profile_, NULL, "" /* session_index, not used */,
|
| + email_, password_, oauth_code,
|
| + start_mode,
|
| + contents,
|
| + confirmation_required,
|
| + sync_callback);
|
| + }
|
| }
|
|
|
| email_.clear();
|
| @@ -347,17 +359,18 @@ class InlineLoginUIHandler : public GaiaAuthConsumer,
|
| void SyncStarterCallback(OneClickSigninSyncStarter::SyncSetupResult result) {
|
| content::WebContents* contents = web_ui()->GetWebContents();
|
| const GURL& current_url = contents->GetURL();
|
| - bool auto_close = signin::IsAutoCloseEnabledInURL(current_url);
|
| - signin::Source source = signin::GetSourceForPromoURL(current_url);
|
| - if (auto_close) {
|
| +
|
| + if (signin::IsAutoCloseEnabledInURL(current_url)) {
|
| base::MessageLoop::current()->PostTask(
|
| FROM_HERE,
|
| base::Bind(
|
| &InlineLoginUIHandler::CloseTab, weak_factory_.GetWeakPtr()));
|
| - return;
|
| + } else {
|
| + signin::Source source = signin::GetSourceForPromoURL(current_url);
|
| + DCHECK(source != signin::SOURCE_UNKNOWN);
|
| + OneClickSigninHelper::RedirectToNtpOrAppsPageIfNecessary(
|
| + contents, source);
|
| }
|
| -
|
| - OneClickSigninHelper::RedirectToNtpOrAppsPageIfNecessary(contents, source);
|
| }
|
|
|
| void CloseTab() {
|
|
|