Chromium Code Reviews| Index: chrome/browser/ui/sync/one_click_signin_helper.cc |
| diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc |
| index d215d824594d2622d005cd5ef6d344eeda8efca8..3997a227384cdd9d53cbcf7edd90cf5f56a060f4 100644 |
| --- a/chrome/browser/ui/sync/one_click_signin_helper.cc |
| +++ b/chrome/browser/ui/sync/one_click_signin_helper.cc |
| @@ -521,6 +521,7 @@ bool OneClickInfoBarDelegateImpl::Accept() { |
| ShowOneClickSigninBubble( |
| BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE, |
| UTF8ToUTF16(email_), |
| + string16() /* no error message to display */, |
| base::Bind(&StartSync, |
| StartSyncArgs(profile, browser, |
| OneClickSigninHelper::AUTO_ACCEPT_NONE, |
| @@ -937,6 +938,7 @@ void OneClickSigninHelper::ShowInfoBarUIThread( |
| (auto_accept != AUTO_ACCEPT_EXPLICIT && |
| helper->auto_accept_ != AUTO_ACCEPT_EXPLICIT) ? |
| CAN_OFFER_FOR_INTERSTITAL_ONLY : CAN_OFFER_FOR_ALL; |
| + |
| std::string error_message; |
| if (!web_contents || !CanOffer(web_contents, can_offer_for, email, |
| @@ -971,19 +973,30 @@ void OneClickSigninHelper::ShowInfoBarUIThread( |
| helper->continue_url_ = continue_url; |
| } |
| -void OneClickSigninHelper::RedirectToNtpOrAppsPage(bool show_bubble) { |
| - VLOG(1) << "OneClickSigninHelper::RedirectToNtpOrAppsPage"; |
| - |
| - // Redirect to NTP/Apps page with sign in bubble visible. |
| +void OneClickSigninHelper::ShowSyncConfirmationBubble(bool show_bubble) { |
| content::WebContents* contents = web_contents(); |
| Profile* profile = |
| Profile::FromBrowserContext(contents->GetBrowserContext()); |
|
Roger Tawa OOO till Jul 10th
2013/04/23 19:49:12
Can move these variables into the if block.
|
| - PrefService* pref_service = profile->GetPrefs(); |
| + |
| if (show_bubble) { |
| - pref_service->SetBoolean(prefs::kSyncPromoShowNTPBubble, true); |
| - pref_service->SetString(prefs::kSyncPromoErrorMessage, error_message_); |
| + Browser* browser = chrome::FindBrowserWithWebContents(contents); |
| + browser->window()->ShowOneClickSigninBubble( |
| + BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE, |
| + string16(), /* no SAML email */ |
| + UTF8ToUTF16(error_message_), |
| + base::Bind(&StartSync, |
| + StartSyncArgs(profile, browser, AUTO_ACCEPT_ACCEPTED, |
| + session_index_, email_, password_, |
| + false))); |
| } |
| + error_message_.clear(); |
| +} |
| +void OneClickSigninHelper::RedirectToNtpOrAppsPage(bool show_bubble) { |
| + VLOG(1) << "OneClickSigninHelper::RedirectToNtpOrAppsPage"; |
| + |
| + // Redirect to NTP/Apps page and display a confirmation bubble |
| + content::WebContents* contents = web_contents(); |
| GURL url(chrome::IsInstantExtendedAPIEnabled() ? |
| chrome::kChromeUIAppsURL : chrome::kChromeUINewTabURL); |
| content::OpenURLParams params(url, |
| @@ -993,7 +1006,7 @@ void OneClickSigninHelper::RedirectToNtpOrAppsPage(bool show_bubble) { |
| false); |
| contents->OpenURL(params); |
| - error_message_.clear(); |
| + ShowSyncConfirmationBubble(show_bubble); |
| } |
| void OneClickSigninHelper::RedirectToSignin() { |
| @@ -1230,6 +1243,7 @@ void OneClickSigninHelper::DidStopLoading( |
| browser->window()->ShowOneClickSigninBubble( |
| bubble_type, |
| UTF8ToUTF16(email_), |
| + string16(), /* no error message to display */ |
| base::Bind(&StartSync, |
| StartSyncArgs(profile, browser, auto_accept_, |
| session_index_, email_, password_, |
| @@ -1268,6 +1282,7 @@ void OneClickSigninHelper::DidStopLoading( |
| browser->window()->ShowOneClickSigninBubble( |
| BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_SAML_MODAL_DIALOG, |
| UTF8ToUTF16(email_), |
| + string16(), /* no error message to display */ |
| base::Bind(&StartSync, |
| StartSyncArgs(profile, browser, auto_accept_, |
| session_index_, email_, password_, |
| @@ -1383,15 +1398,11 @@ void OneClickSigninHelper::SigninFailed(const GoogleServiceAuthError& error) { |
| break; |
| } |
| } |
| - RedirectOnSigninComplete(display_bubble); |
| + ShowSyncConfirmationBubble(display_bubble); |
| + signin_tracker_.reset(); |
| } |
| void OneClickSigninHelper::SigninSuccess() { |
| - RedirectOnSigninComplete(true); |
| -} |
| - |
| -void OneClickSigninHelper::RedirectOnSigninComplete(bool show_bubble) { |
| - // Show the result in the sign-in bubble if desired. |
| - RedirectToNtpOrAppsPage(show_bubble); |
| + ShowSyncConfirmationBubble(true); |
| signin_tracker_.reset(); |
| } |