| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 } | 501 } |
| 502 | 502 |
| 503 string16 OneClickInfoBarDelegateImpl::GetButtonLabel( | 503 string16 OneClickInfoBarDelegateImpl::GetButtonLabel( |
| 504 InfoBarButton button) const { | 504 InfoBarButton button) const { |
| 505 return l10n_util::GetStringUTF16( | 505 return l10n_util::GetStringUTF16( |
| 506 (button == BUTTON_OK) ? IDS_ONE_CLICK_SIGNIN_INFOBAR_OK_BUTTON | 506 (button == BUTTON_OK) ? IDS_ONE_CLICK_SIGNIN_INFOBAR_OK_BUTTON |
| 507 : IDS_ONE_CLICK_SIGNIN_INFOBAR_CANCEL_BUTTON); | 507 : IDS_ONE_CLICK_SIGNIN_INFOBAR_CANCEL_BUTTON); |
| 508 } | 508 } |
| 509 | 509 |
| 510 bool OneClickInfoBarDelegateImpl::Accept() { | 510 bool OneClickInfoBarDelegateImpl::Accept() { |
| 511 content::WebContents* web_contents = owner()->GetWebContents(); | 511 content::WebContents* web_contents = owner()->web_contents(); |
| 512 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 512 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
| 513 Profile* profile = Profile::FromBrowserContext( | 513 Profile* profile = Profile::FromBrowserContext( |
| 514 web_contents->GetBrowserContext()); | 514 web_contents->GetBrowserContext()); |
| 515 | 515 |
| 516 // User has accepted one-click sign-in for this account. Never ask again for | 516 // User has accepted one-click sign-in for this account. Never ask again for |
| 517 // this profile. | 517 // this profile. |
| 518 SigninManager::DisableOneClickSignIn(profile); | 518 SigninManager::DisableOneClickSignIn(profile); |
| 519 RecordHistogramAction(one_click_signin::HISTOGRAM_ACCEPTED); | 519 RecordHistogramAction(one_click_signin::HISTOGRAM_ACCEPTED); |
| 520 chrome::FindBrowserWithWebContents(web_contents)->window()-> | 520 chrome::FindBrowserWithWebContents(web_contents)->window()-> |
| 521 ShowOneClickSigninBubble( | 521 ShowOneClickSigninBubble( |
| 522 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE, | 522 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE, |
| 523 UTF8ToUTF16(email_), | 523 UTF8ToUTF16(email_), |
| 524 base::Bind(&StartSync, | 524 base::Bind(&StartSync, |
| 525 StartSyncArgs(profile, browser, | 525 StartSyncArgs(profile, browser, |
| 526 OneClickSigninHelper::AUTO_ACCEPT_NONE, | 526 OneClickSigninHelper::AUTO_ACCEPT_NONE, |
| 527 session_index_, email_, password_, | 527 session_index_, email_, password_, |
| 528 false /* force_same_tab_navigation */))); | 528 false /* force_same_tab_navigation */))); |
| 529 button_pressed_ = true; | 529 button_pressed_ = true; |
| 530 return true; | 530 return true; |
| 531 } | 531 } |
| 532 | 532 |
| 533 bool OneClickInfoBarDelegateImpl::Cancel() { | 533 bool OneClickInfoBarDelegateImpl::Cancel() { |
| 534 AddEmailToOneClickRejectedList(Profile::FromBrowserContext( | 534 AddEmailToOneClickRejectedList(Profile::FromBrowserContext( |
| 535 owner()->GetWebContents()->GetBrowserContext()), email_); | 535 owner()->web_contents()->GetBrowserContext()), email_); |
| 536 RecordHistogramAction(one_click_signin::HISTOGRAM_REJECTED); | 536 RecordHistogramAction(one_click_signin::HISTOGRAM_REJECTED); |
| 537 button_pressed_ = true; | 537 button_pressed_ = true; |
| 538 return true; | 538 return true; |
| 539 } | 539 } |
| 540 | 540 |
| 541 string16 OneClickInfoBarDelegateImpl::GetLinkText() const { | 541 string16 OneClickInfoBarDelegateImpl::GetLinkText() const { |
| 542 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 542 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
| 543 } | 543 } |
| 544 | 544 |
| 545 bool OneClickInfoBarDelegateImpl::LinkClicked( | 545 bool OneClickInfoBarDelegateImpl::LinkClicked( |
| 546 WindowOpenDisposition disposition) { | 546 WindowOpenDisposition disposition) { |
| 547 RecordHistogramAction(one_click_signin::HISTOGRAM_LEARN_MORE); | 547 RecordHistogramAction(one_click_signin::HISTOGRAM_LEARN_MORE); |
| 548 content::OpenURLParams params( | 548 content::OpenURLParams params( |
| 549 GURL(chrome::kChromeSyncLearnMoreURL), content::Referrer(), | 549 GURL(chrome::kChromeSyncLearnMoreURL), content::Referrer(), |
| 550 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, | 550 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, |
| 551 content::PAGE_TRANSITION_LINK, false); | 551 content::PAGE_TRANSITION_LINK, false); |
| 552 owner()->GetWebContents()->OpenURL(params); | 552 owner()->web_contents()->OpenURL(params); |
| 553 return false; | 553 return false; |
| 554 } | 554 } |
| 555 | 555 |
| 556 void OneClickInfoBarDelegateImpl::GetAlternateColors( | 556 void OneClickInfoBarDelegateImpl::GetAlternateColors( |
| 557 AlternateColors* alt_colors) { | 557 AlternateColors* alt_colors) { |
| 558 if (use_blue_on_white) { | 558 if (use_blue_on_white) { |
| 559 alt_colors->enabled = true; | 559 alt_colors->enabled = true; |
| 560 alt_colors->infobar_bottom_color = SK_ColorWHITE; | 560 alt_colors->infobar_bottom_color = SK_ColorWHITE; |
| 561 alt_colors->infobar_top_color = SK_ColorWHITE; | 561 alt_colors->infobar_top_color = SK_ColorWHITE; |
| 562 alt_colors->button_text_color = SK_ColorWHITE; | 562 alt_colors->button_text_color = SK_ColorWHITE; |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 | 1389 |
| 1390 void OneClickSigninHelper::SigninSuccess() { | 1390 void OneClickSigninHelper::SigninSuccess() { |
| 1391 RedirectOnSigninComplete(true); | 1391 RedirectOnSigninComplete(true); |
| 1392 } | 1392 } |
| 1393 | 1393 |
| 1394 void OneClickSigninHelper::RedirectOnSigninComplete(bool show_bubble) { | 1394 void OneClickSigninHelper::RedirectOnSigninComplete(bool show_bubble) { |
| 1395 // Show the result in the sign-in bubble if desired. | 1395 // Show the result in the sign-in bubble if desired. |
| 1396 RedirectToNtpOrAppsPage(show_bubble); | 1396 RedirectToNtpOrAppsPage(show_bubble); |
| 1397 signin_tracker_.reset(); | 1397 signin_tracker_.reset(); |
| 1398 } | 1398 } |
| OLD | NEW |