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 a467179097b4f46628e495d83ec2ba430415eec6..0d58a1de11a8597435b32629faba65f8852d77d3 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_list.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,19 +130,6 @@ 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, |
@@ -155,20 +143,18 @@ void StartSync(content::WebContents* web_contents, |
new OneClickSigninSyncStarter( |
profile, session_index, email, password, use_default_settings)); |
akalin
2012/05/17 00:39:24
Can you turn use_default_settings into an enum? I
Roger Tawa OOO till Jul 10th
2012/05/17 21:17:37
I'll see how best to handle this. I'm not sure I
|
- Browser* browser = BrowserList::FindBrowserWithWebContents(web_contents); |
- browser->window()->ShowOneClickSigninBubble( |
- base::Bind(&OnLearnMore, base::Unretained(browser)), |
- base::Bind(&OnAdvanced, base::Unretained(browser))); |
+ // TODO(rogerta): record histogram. |
} |
} // 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 = BrowserList::FindBrowserWithWebContents(web_contents); |
+ browser->window()->ShowOneClickSigninBubble( |
+ base::Bind(&StartSync, web_contents, session_index_, email_, |
password_)); |
button_pressed_ = true; |
return true; |
@@ -181,6 +167,27 @@ bool OneClickLoginInfoBarDelegate::Cancel() { |
return true; |
} |
+string16 OneClickLoginInfoBarDelegate::GetLinkText() const { |
+ return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
+} |
+ |
+bool OneClickLoginInfoBarDelegate::LinkClicked( |
+ WindowOpenDisposition disposition) { |
+ 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. |
+ content::PAGE_TRANSITION_TYPED, |
+ false); |
+ owner()->web_contents()->OpenURL(params); |
+ |
+ // We should always close, even if the navigation did not occur within this |
+ // WebContents. |
+ return true; |
+} |
+ |
+ |
InfoBarDelegate::InfoBarAutomationType |
OneClickLoginInfoBarDelegate::GetInfoBarAutomationType() const { |
return ONE_CLICK_LOGIN_INFOBAR; |