Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6590)

Unified Diff: chrome/browser/ui/webui/inline_login_ui.cc

Issue 116543007: Add cross account error detection to inline signin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698