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

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

Issue 10391158: Moves methods for finding browsers to browser_finder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include fixs Created 8 years, 7 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/infobars/infobar_tab_helper.h" 13 #include "chrome/browser/infobars/infobar_tab_helper.h"
14 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_info_cache.h" 16 #include "chrome/browser/profiles/profile_info_cache.h"
17 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/signin/signin_manager.h" 18 #include "chrome/browser/signin/signin_manager.h"
19 #include "chrome/browser/signin/signin_manager_factory.h" 19 #include "chrome/browser/signin/signin_manager_factory.h"
20 #include "chrome/browser/sync/profile_sync_service.h" 20 #include "chrome/browser/sync/profile_sync_service.h"
21 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h" 21 #include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
22 #include "chrome/browser/tab_contents/tab_util.h" 22 #include "chrome/browser/tab_contents/tab_util.h"
23 #include "chrome/browser/ui/browser_list.h" 23 #include "chrome/browser/ui/browser_finder.h"
24 #include "chrome/browser/ui/browser_window.h" 24 #include "chrome/browser/ui/browser_window.h"
25 #include "chrome/browser/ui/sync/one_click_signin_dialog.h" 25 #include "chrome/browser/ui/sync/one_click_signin_dialog.h"
26 #include "chrome/browser/ui/sync/one_click_signin_histogram.h" 26 #include "chrome/browser/ui/sync/one_click_signin_histogram.h"
27 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h" 27 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 28 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
29 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
30 #include "chrome/common/url_constants.h" 30 #include "chrome/common/url_constants.h"
31 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
32 #include "content/public/browser/page_navigator.h" 32 #include "content/public/browser/page_navigator.h"
33 #include "content/public/browser/web_contents.h" 33 #include "content/public/browser/web_contents.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 const std::string& email, 148 const std::string& email,
149 const std::string& password, 149 const std::string& password,
150 bool use_default_settings) { 150 bool use_default_settings) {
151 // The starter deletes itself once its done. 151 // The starter deletes itself once its done.
152 Profile* profile = 152 Profile* profile =
153 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 153 Profile::FromBrowserContext(web_contents->GetBrowserContext());
154 ignore_result( 154 ignore_result(
155 new OneClickSigninSyncStarter( 155 new OneClickSigninSyncStarter(
156 profile, session_index, email, password, use_default_settings)); 156 profile, session_index, email, password, use_default_settings));
157 157
158 Browser* browser = BrowserList::FindBrowserWithWebContents(web_contents); 158 Browser* browser = browser::FindBrowserWithWebContents(web_contents);
159 browser->window()->ShowOneClickSigninBubble( 159 browser->window()->ShowOneClickSigninBubble(
160 base::Bind(&OnLearnMore, base::Unretained(browser)), 160 base::Bind(&OnLearnMore, base::Unretained(browser)),
161 base::Bind(&OnAdvanced, base::Unretained(browser))); 161 base::Bind(&OnAdvanced, base::Unretained(browser)));
162 } 162 }
163 163
164 } // namespace 164 } // namespace
165 165
166 bool OneClickLoginInfoBarDelegate::Accept() { 166 bool OneClickLoginInfoBarDelegate::Accept() {
167 DisableOneClickSignIn(); 167 DisableOneClickSignIn();
168 RecordHistogramAction(one_click_signin::HISTOGRAM_ACCEPTED); 168 RecordHistogramAction(one_click_signin::HISTOGRAM_ACCEPTED);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 session_index_ = session_index; 345 session_index_ = session_index;
346 email_ = email; 346 email_ = email;
347 } 347 }
348 348
349 void OneClickSigninHelper::SavePassword(const std::string& password) { 349 void OneClickSigninHelper::SavePassword(const std::string& password) {
350 // TODO(rogerta): in the case of a 2-factor or captcha or some other type of 350 // TODO(rogerta): in the case of a 2-factor or captcha or some other type of
351 // challenge, its possible for the user to never complete the signin. 351 // challenge, its possible for the user to never complete the signin.
352 // Should have a way to detect this and clear the password member. 352 // Should have a way to detect this and clear the password member.
353 password_ = password; 353 password_ = password;
354 } 354 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698