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

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

Issue 11434074: browser: Move FindBrowserWithWebContents() into chrome namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 return l10n_util::GetStringUTF16( 283 return l10n_util::GetStringUTF16(
284 (button == BUTTON_OK) ? IDS_ONE_CLICK_SIGNIN_INFOBAR_OK_BUTTON 284 (button == BUTTON_OK) ? IDS_ONE_CLICK_SIGNIN_INFOBAR_OK_BUTTON
285 : IDS_ONE_CLICK_SIGNIN_INFOBAR_CANCEL_BUTTON); 285 : IDS_ONE_CLICK_SIGNIN_INFOBAR_CANCEL_BUTTON);
286 } 286 }
287 287
288 bool OneClickInfoBarDelegateImpl::Accept() { 288 bool OneClickInfoBarDelegateImpl::Accept() {
289 // User has accepted one-click sign-in for this account. Never ask again for 289 // User has accepted one-click sign-in for this account. Never ask again for
290 // this profile. 290 // this profile.
291 DisableOneClickSignIn(); 291 DisableOneClickSignIn();
292 content::WebContents* web_contents = owner()->GetWebContents(); 292 content::WebContents* web_contents = owner()->GetWebContents();
293 Browser* browser = browser::FindBrowserWithWebContents(web_contents); 293 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
294 RecordHistogramAction(one_click_signin::HISTOGRAM_ACCEPTED); 294 RecordHistogramAction(one_click_signin::HISTOGRAM_ACCEPTED);
295 browser::FindBrowserWithWebContents(web_contents)->window()-> 295 chrome::FindBrowserWithWebContents(web_contents)->window()->
296 ShowOneClickSigninBubble(base::Bind(&StartSync, browser, 296 ShowOneClickSigninBubble(base::Bind(&StartSync, browser,
297 OneClickSigninHelper::NO_AUTO_ACCEPT, 297 OneClickSigninHelper::NO_AUTO_ACCEPT,
298 session_index_, email_, password_)); 298 session_index_, email_, password_));
299 button_pressed_ = true; 299 button_pressed_ = true;
300 return true; 300 return true;
301 } 301 }
302 302
303 bool OneClickInfoBarDelegateImpl::Cancel() { 303 bool OneClickInfoBarDelegateImpl::Cancel() {
304 AddEmailToOneClickRejectedList(email_); 304 AddEmailToOneClickRejectedList(email_);
305 RecordHistogramAction(one_click_signin::HISTOGRAM_REJECTED); 305 RecordHistogramAction(one_click_signin::HISTOGRAM_REJECTED);
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 password_ = UTF16ToUTF8(params.password_form.password_value); 698 password_ = UTF16ToUTF8(params.password_form.password_value);
699 } 699 }
700 } 700 }
701 701
702 void OneClickSigninHelper::DidStopLoading( 702 void OneClickSigninHelper::DidStopLoading(
703 content::RenderViewHost* render_view_host) { 703 content::RenderViewHost* render_view_host) {
704 if (email_.empty() || password_.empty()) 704 if (email_.empty() || password_.empty())
705 return; 705 return;
706 706
707 content::WebContents* contents = web_contents(); 707 content::WebContents* contents = web_contents();
708 Browser* browser = browser::FindBrowserWithWebContents(contents); 708 Browser* browser = chrome::FindBrowserWithWebContents(contents);
709 InfoBarTabHelper* infobar_tab_helper = 709 InfoBarTabHelper* infobar_tab_helper =
710 InfoBarTabHelper::FromWebContents(contents); 710 InfoBarTabHelper::FromWebContents(contents);
711 711
712 switch (auto_accept_) { 712 switch (auto_accept_) {
713 case AUTO_ACCEPT: 713 case AUTO_ACCEPT:
714 browser->window()->ShowOneClickSigninBubble( 714 browser->window()->ShowOneClickSigninBubble(
715 base::Bind(&StartSync, browser, auto_accept_, session_index_, 715 base::Bind(&StartSync, browser, auto_accept_, session_index_,
716 email_, password_)); 716 email_, password_));
717 break; 717 break;
718 case NO_AUTO_ACCEPT: 718 case NO_AUTO_ACCEPT:
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 std::string()); 778 std::string());
779 } 779 }
780 780
781 void OneClickSigninHelper::SigninFailed(const GoogleServiceAuthError& error) { 781 void OneClickSigninHelper::SigninFailed(const GoogleServiceAuthError& error) {
782 signin_tracker_.reset(); 782 signin_tracker_.reset();
783 } 783 }
784 784
785 void OneClickSigninHelper::SigninSuccess() { 785 void OneClickSigninHelper::SigninSuccess() {
786 signin_tracker_.reset(); 786 signin_tracker_.reset();
787 } 787 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/session_crashed_prompt.cc ('k') | chrome/browser/ui/views/create_application_shortcut_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698