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 736af5e55c663be4638903dec557127f6e7f4707..7164f8d5117f33533c06e3d3e9f961d16c75a319 100644 |
| --- a/chrome/browser/ui/sync/one_click_signin_helper.cc |
| +++ b/chrome/browser/ui/sync/one_click_signin_helper.cc |
| @@ -22,7 +22,6 @@ |
| #include "chrome/browser/tab_contents/tab_util.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| #include "chrome/browser/ui/browser_window.h" |
| -#include "chrome/browser/ui/sync/one_click_signin_dialog.h" |
| #include "chrome/browser/ui/sync/one_click_signin_histogram.h" |
| #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" |
| #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| @@ -63,6 +62,8 @@ class OneClickLoginInfoBarDelegate : public ConfirmInfoBarDelegate { |
| virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; |
| virtual bool Accept() OVERRIDE; |
| virtual bool Cancel() OVERRIDE; |
| + virtual string16 GetLinkText() const OVERRIDE; |
| + virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; |
| virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE; |
| @@ -129,46 +130,29 @@ string16 OneClickLoginInfoBarDelegate::GetButtonLabel( |
| namespace { |
| -void OnLearnMore(Browser* browser) { |
| - browser->AddSelectedTabWithURL( |
| - GURL(chrome::kSyncLearnMoreURL), |
| - content::PAGE_TRANSITION_AUTO_BOOKMARK); |
| -} |
| - |
| -void OnAdvanced(Browser* browser) { |
| - browser->AddSelectedTabWithURL( |
| - GURL(std::string(chrome::kChromeUISettingsURL) + |
| - chrome::kSyncSetupSubPage), |
| - content::PAGE_TRANSITION_AUTO_BOOKMARK); |
| -} |
| - |
| // Start syncing with the given user information. |
| void StartSync(content::WebContents* web_contents, |
| const std::string& session_index, |
| const std::string& email, |
| const std::string& password, |
| - bool use_default_settings) { |
| + OneClickSigninSyncStarter::StartSyncMode start_mode) { |
| // The starter deletes itself once its done. |
| Profile* profile = |
| Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| ignore_result( |
|
Peter Kasting
2012/05/24 22:25:18
Nit: ignore_result() not needed here?
Roger Tawa OOO till Jul 10th
2012/05/25 16:04:08
Done.
|
| new OneClickSigninSyncStarter( |
| - profile, session_index, email, password, use_default_settings)); |
| - |
| - Browser* browser = browser::FindBrowserWithWebContents(web_contents); |
| - browser->window()->ShowOneClickSigninBubble( |
| - base::Bind(&OnLearnMore, base::Unretained(browser)), |
| - base::Bind(&OnAdvanced, base::Unretained(browser))); |
| + profile, session_index, email, password, start_mode)); |
|
Peter Kasting
2012/05/24 22:25:18
Nit: Could put half of args on previous line and i
Roger Tawa OOO till Jul 10th
2012/05/25 16:04:08
Done.
|
| } |
| } // namespace |
| bool OneClickLoginInfoBarDelegate::Accept() { |
| DisableOneClickSignIn(); |
| + content::WebContents* web_contents = owner()->web_contents(); |
| RecordHistogramAction(one_click_signin::HISTOGRAM_ACCEPTED); |
| - ShowOneClickSigninDialog( |
| - owner()->web_contents()->GetView()->GetTopLevelNativeWindow(), |
| - base::Bind(&StartSync, owner()->web_contents(), session_index_, email_, |
| + Browser* browser = browser::FindBrowserWithWebContents(web_contents); |
|
Peter Kasting
2012/05/24 22:25:18
Nit: Just inline this into the next line
Roger Tawa OOO till Jul 10th
2012/05/25 16:04:08
Done.
|
| + browser->window()->ShowOneClickSigninBubble( |
| + base::Bind(&StartSync, web_contents, session_index_, email_, |
| password_)); |
| button_pressed_ = true; |
| return true; |
| @@ -181,6 +165,28 @@ bool OneClickLoginInfoBarDelegate::Cancel() { |
| return true; |
| } |
| +string16 OneClickLoginInfoBarDelegate::GetLinkText() const { |
| + return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| +} |
| + |
| +bool OneClickLoginInfoBarDelegate::LinkClicked( |
| + WindowOpenDisposition disposition) { |
| + RecordHistogramAction(one_click_signin::HISTOGRAM_LEARN_MORE); |
| + content::OpenURLParams params( |
| + GURL(chrome::kChromeSyncLearnMoreURL), content::Referrer(), disposition, |
| + // Pretend the user typed this URL, so that navigating to |
| + // it will be the default action when it's typed again in |
| + // the future. |
|
Peter Kasting
2012/05/24 22:25:18
What? You don't want this. This looks like bad c
Roger Tawa OOO till Jul 10th
2012/05/25 16:04:08
Done. Yes my bad, a pasted and then forgot to bac
|
| + content::PAGE_TRANSITION_TYPED, |
| + false); |
| + owner()->web_contents()->OpenURL(params); |
| + |
| + // We should always close, even if the navigation did not occur within this |
| + // WebContents. |
|
Peter Kasting
2012/05/24 22:25:18
This seems wrong too.
Roger Tawa OOO till Jul 10th
2012/05/25 16:04:08
Done.
|
| + return true; |
| +} |
| + |
| + |
| InfoBarDelegate::InfoBarAutomationType |
| OneClickLoginInfoBarDelegate::GetInfoBarAutomationType() const { |
| return ONE_CLICK_LOGIN_INFOBAR; |