Chromium Code Reviews| 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 d973be72cee0154e10236815dbeb48bad968adf6..f632164ac81d0d6a1c5e87ee6c39270f6be67358 100644 |
| --- a/chrome/browser/ui/webui/inline_login_ui.cc |
| +++ b/chrome/browser/ui/webui/inline_login_ui.cc |
| @@ -25,6 +25,7 @@ |
| #include "chrome/browser/sync/profile_sync_service.h" |
| #include "chrome/browser/sync/profile_sync_service_factory.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| +#include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
| #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| #include "chrome/common/chrome_switches.h" |
| @@ -207,6 +208,18 @@ class InlineLoginUIHandler : public content::WebUIMessageHandler { |
| dict->GetBoolean("chooseWhatToSync", &choose_what_to_sync_); |
| content::WebContents* web_contents = web_ui()->GetWebContents(); |
| + std::string error_msg; |
| + OneClickSigninHelper::CanOffer( |
| + web_contents, OneClickSigninHelper::CAN_OFFER_FOR_ALL, |
| + UTF16ToASCII(email), &error_msg); |
| + if (!error_msg.empty()) { |
| + RedirectToNtpOrAppsPage( |
| + web_contents, signin::GetSourceForPromoURL(web_contents->GetURL())); |
| + Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
| + OneClickSigninHelper::ShowSigninErrorBubble(browser, error_msg); |
| + return; |
| + } |
| + |
| content::StoragePartition* partition = |
| content::BrowserContext::GetStoragePartitionForSite( |
| web_contents->GetBrowserContext(), |
| @@ -288,20 +301,25 @@ class InlineLoginUIHandler : public content::WebUIMessageHandler { |
| } else if (source != signin::SOURCE_UNKNOWN && |
| source != signin::SOURCE_SETTINGS && |
| source != signin::SOURCE_WEBSTORE_INSTALL) { |
| - // Redirect to NTP/Apps page and display a confirmation bubble. |
| // TODO(guohui): should redirect to the given continue url for webstore |
| // install flows. |
| - GURL url(source == signin::SOURCE_APPS_PAGE_LINK ? |
| - chrome::kChromeUIAppsURL : chrome::kChromeUINewTabURL); |
| - content::OpenURLParams params(url, |
| - content::Referrer(), |
| - CURRENT_TAB, |
| - content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| - false); |
| - contents->OpenURL(params); |
| + RedirectToNtpOrAppsPage(contents, source); |
| } |
| } |
| + void RedirectToNtpOrAppsPage(content::WebContents* contents, |
| + signin::Source source) { |
| + VLOG(1) << "RedirectToNtpOrAppsPage"; |
| + GURL url(source == signin::SOURCE_APPS_PAGE_LINK ? |
| + chrome::kChromeUIAppsURL : chrome::kChromeUINewTabURL); |
| + content::OpenURLParams params(url, |
| + content::Referrer(), |
| + CURRENT_TAB, |
| + content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
| + false); |
| + contents->OpenURL(params); |
| + } |
|
Roger Tawa OOO till Jul 10th
2013/12/02 21:04:51
Should reuse function from OneClickSigninHelper, l
|
| + |
| void CloseTab() { |
| content::WebContents* tab = web_ui()->GetWebContents(); |
| Browser* browser = chrome::FindBrowserWithWebContents(tab); |