Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_helper.cc

Issue 14241006: Eliminate InfoBarTabHelper. Make InfoBarService a concrete class. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 } 545 }
546 546
547 string16 OneClickInfoBarDelegateImpl::GetButtonLabel( 547 string16 OneClickInfoBarDelegateImpl::GetButtonLabel(
548 InfoBarButton button) const { 548 InfoBarButton button) const {
549 return l10n_util::GetStringUTF16( 549 return l10n_util::GetStringUTF16(
550 (button == BUTTON_OK) ? IDS_ONE_CLICK_SIGNIN_INFOBAR_OK_BUTTON 550 (button == BUTTON_OK) ? IDS_ONE_CLICK_SIGNIN_INFOBAR_OK_BUTTON
551 : IDS_ONE_CLICK_SIGNIN_INFOBAR_CANCEL_BUTTON); 551 : IDS_ONE_CLICK_SIGNIN_INFOBAR_CANCEL_BUTTON);
552 } 552 }
553 553
554 bool OneClickInfoBarDelegateImpl::Accept() { 554 bool OneClickInfoBarDelegateImpl::Accept() {
555 content::WebContents* web_contents = owner()->GetWebContents(); 555 content::WebContents* web_contents = owner()->web_contents();
556 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 556 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
557 Profile* profile = Profile::FromBrowserContext( 557 Profile* profile = Profile::FromBrowserContext(
558 web_contents->GetBrowserContext()); 558 web_contents->GetBrowserContext());
559 559
560 // User has accepted one-click sign-in for this account. Never ask again for 560 // User has accepted one-click sign-in for this account. Never ask again for
561 // this profile. 561 // this profile.
562 SigninManager::DisableOneClickSignIn(profile); 562 SigninManager::DisableOneClickSignIn(profile);
563 RecordHistogramAction(one_click_signin::HISTOGRAM_ACCEPTED); 563 RecordHistogramAction(one_click_signin::HISTOGRAM_ACCEPTED);
564 chrome::FindBrowserWithWebContents(web_contents)->window()-> 564 chrome::FindBrowserWithWebContents(web_contents)->window()->
565 ShowOneClickSigninBubble( 565 ShowOneClickSigninBubble(
566 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE, 566 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE,
567 UTF8ToUTF16(email_), 567 UTF8ToUTF16(email_),
568 base::Bind(&StartSync, 568 base::Bind(&StartSync,
569 StartSyncArgs(profile, browser, 569 StartSyncArgs(profile, browser,
570 OneClickSigninHelper::AUTO_ACCEPT_NONE, 570 OneClickSigninHelper::AUTO_ACCEPT_NONE,
571 session_index_, email_, password_, 571 session_index_, email_, password_,
572 false /* force_same_tab_navigation */))); 572 false /* force_same_tab_navigation */)));
573 button_pressed_ = true; 573 button_pressed_ = true;
574 return true; 574 return true;
575 } 575 }
576 576
577 bool OneClickInfoBarDelegateImpl::Cancel() { 577 bool OneClickInfoBarDelegateImpl::Cancel() {
578 AddEmailToOneClickRejectedList(Profile::FromBrowserContext( 578 AddEmailToOneClickRejectedList(Profile::FromBrowserContext(
579 owner()->GetWebContents()->GetBrowserContext()), email_); 579 owner()->web_contents()->GetBrowserContext()), email_);
580 RecordHistogramAction(one_click_signin::HISTOGRAM_REJECTED); 580 RecordHistogramAction(one_click_signin::HISTOGRAM_REJECTED);
581 button_pressed_ = true; 581 button_pressed_ = true;
582 return true; 582 return true;
583 } 583 }
584 584
585 string16 OneClickInfoBarDelegateImpl::GetLinkText() const { 585 string16 OneClickInfoBarDelegateImpl::GetLinkText() const {
586 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); 586 return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
587 } 587 }
588 588
589 bool OneClickInfoBarDelegateImpl::LinkClicked( 589 bool OneClickInfoBarDelegateImpl::LinkClicked(
590 WindowOpenDisposition disposition) { 590 WindowOpenDisposition disposition) {
591 RecordHistogramAction(one_click_signin::HISTOGRAM_LEARN_MORE); 591 RecordHistogramAction(one_click_signin::HISTOGRAM_LEARN_MORE);
592 content::OpenURLParams params( 592 content::OpenURLParams params(
593 GURL(chrome::kChromeSyncLearnMoreURL), content::Referrer(), 593 GURL(chrome::kChromeSyncLearnMoreURL), content::Referrer(),
594 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 594 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
595 content::PAGE_TRANSITION_LINK, false); 595 content::PAGE_TRANSITION_LINK, false);
596 owner()->GetWebContents()->OpenURL(params); 596 owner()->web_contents()->OpenURL(params);
597 return false; 597 return false;
598 } 598 }
599 599
600 void OneClickInfoBarDelegateImpl::GetAlternateColors( 600 void OneClickInfoBarDelegateImpl::GetAlternateColors(
601 AlternateColors* alt_colors) { 601 AlternateColors* alt_colors) {
602 if (use_blue_on_white) { 602 if (use_blue_on_white) {
603 alt_colors->enabled = true; 603 alt_colors->enabled = true;
604 alt_colors->infobar_bottom_color = SK_ColorWHITE; 604 alt_colors->infobar_bottom_color = SK_ColorWHITE;
605 alt_colors->infobar_top_color = SK_ColorWHITE; 605 alt_colors->infobar_top_color = SK_ColorWHITE;
606 alt_colors->button_text_color = SK_ColorWHITE; 606 alt_colors->button_text_color = SK_ColorWHITE;
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1440 1440
1441 void OneClickSigninHelper::SigninSuccess() { 1441 void OneClickSigninHelper::SigninSuccess() {
1442 RedirectOnSigninComplete(true); 1442 RedirectOnSigninComplete(true);
1443 } 1443 }
1444 1444
1445 void OneClickSigninHelper::RedirectOnSigninComplete(bool show_bubble) { 1445 void OneClickSigninHelper::RedirectOnSigninComplete(bool show_bubble) {
1446 // Show the result in the sign-in bubble if desired. 1446 // Show the result in the sign-in bubble if desired.
1447 RedirectToNtpOrAppsPage(show_bubble); 1447 RedirectToNtpOrAppsPage(show_bubble);
1448 signin_tracker_.reset(); 1448 signin_tracker_.reset();
1449 } 1449 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698