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

Side by Side Diff: chrome/browser/ui/autofill/chrome_autofill_client.cc

Issue 1138653003: Move card unmask interfaces and controller into the autofill component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing override declaration Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/autofill/chrome_autofill_client.h" 5 #include "chrome/browser/ui/autofill/chrome_autofill_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/autofill/personal_data_manager_factory.h" 10 #include "chrome/browser/autofill/personal_data_manager_factory.h"
11 #include "chrome/browser/autofill/risk_util.h" 11 #include "chrome/browser/autofill/risk_util.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/infobars/infobar_service.h" 13 #include "chrome/browser/infobars/infobar_service.h"
14 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 14 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/signin/profile_identity_provider.h" 16 #include "chrome/browser/signin/profile_identity_provider.h"
17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
18 #include "chrome/browser/signin/signin_manager_factory.h" 18 #include "chrome/browser/signin/signin_manager_factory.h"
19 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" 19 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h"
20 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" 20 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
21 #include "chrome/browser/ui/autofill/card_unmask_prompt_view.h" 21 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h"
22 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h" 22 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h"
23 #include "chrome/browser/ui/browser.h" 23 #include "chrome/browser/ui/browser.h"
24 #include "chrome/browser/ui/browser_finder.h" 24 #include "chrome/browser/ui/browser_finder.h"
25 #include "chrome/browser/ui/browser_window.h" 25 #include "chrome/browser/ui/browser_window.h"
26 #include "chrome/browser/ui/chrome_pages.h" 26 #include "chrome/browser/ui/chrome_pages.h"
27 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 27 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
28 #include "chrome/browser/webdata/web_data_service_factory.h" 28 #include "chrome/browser/webdata/web_data_service_factory.h"
29 #include "chrome/common/url_constants.h" 29 #include "chrome/common/url_constants.h"
30 #include "components/autofill/content/browser/content_autofill_driver.h" 30 #include "components/autofill/content/browser/content_autofill_driver.h"
31 #include "components/autofill/content/common/autofill_messages.h" 31 #include "components/autofill/content/common/autofill_messages.h"
32 #include "components/autofill/core/browser/autofill_cc_infobar_delegate.h" 32 #include "components/autofill/core/browser/autofill_cc_infobar_delegate.h"
33 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h"
33 #include "components/autofill/core/common/autofill_pref_names.h" 34 #include "components/autofill/core/common/autofill_pref_names.h"
34 #include "components/password_manager/content/browser/content_password_manager_d river.h" 35 #include "components/password_manager/content/browser/content_password_manager_d river.h"
35 #include "components/user_prefs/user_prefs.h" 36 #include "components/user_prefs/user_prefs.h"
36 #include "content/public/browser/render_frame_host.h" 37 #include "content/public/browser/render_frame_host.h"
37 #include "ui/gfx/geometry/rect.h" 38 #include "ui/gfx/geometry/rect.h"
38 39
39 #if defined(OS_ANDROID) 40 #if defined(OS_ANDROID)
40 #include "chrome/browser/android/chromium_application.h" 41 #include "chrome/browser/android/chromium_application.h"
41 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" 42 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h"
42 #else 43 #else
43 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 44 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
44 #include "components/ui/zoom/zoom_controller.h" 45 #include "components/ui/zoom/zoom_controller.h"
45 #endif 46 #endif
46 47
47 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); 48 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient);
48 49
49 namespace autofill { 50 namespace autofill {
50 51
51 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) 52 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents)
52 : content::WebContentsObserver(web_contents), 53 : content::WebContentsObserver(web_contents),
53 unmask_controller_( 54 unmask_controller_(
54 web_contents,
55 base::Bind(&LoadRiskData, 0, web_contents), 55 base::Bind(&LoadRiskData, 0, web_contents),
56 user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()), 56 user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()),
57 Profile::FromBrowserContext(web_contents->GetBrowserContext()) 57 Profile::FromBrowserContext(web_contents->GetBrowserContext())
58 ->IsOffTheRecord()), 58 ->IsOffTheRecord()),
59 last_rfh_to_rac_(nullptr) { 59 last_rfh_to_rac_(nullptr) {
60 DCHECK(web_contents); 60 DCHECK(web_contents);
61 61
62 #if !defined(OS_ANDROID) 62 #if !defined(OS_ANDROID)
63 // Since ZoomController is also a WebContentsObserver, we need to be careful 63 // Since ZoomController is also a WebContentsObserver, we need to be careful
64 // about disconnecting from it since the relative order of destruction of 64 // about disconnecting from it since the relative order of destruction of
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 #else 140 #else
141 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); 141 Browser* browser = chrome::FindBrowserWithWebContents(web_contents());
142 if (browser) 142 if (browser)
143 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage); 143 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage);
144 #endif // #if defined(OS_ANDROID) 144 #endif // #if defined(OS_ANDROID)
145 } 145 }
146 146
147 void ChromeAutofillClient::ShowUnmaskPrompt( 147 void ChromeAutofillClient::ShowUnmaskPrompt(
148 const CreditCard& card, 148 const CreditCard& card,
149 base::WeakPtr<CardUnmaskDelegate> delegate) { 149 base::WeakPtr<CardUnmaskDelegate> delegate) {
150 unmask_controller_.ShowPrompt(card, delegate); 150 unmask_controller_.ShowPrompt(
151 CreateCardUnmaskPromptView(&unmask_controller_, web_contents()),
152 card, delegate);
151 } 153 }
152 154
153 void ChromeAutofillClient::OnUnmaskVerificationResult(GetRealPanResult result) { 155 void ChromeAutofillClient::OnUnmaskVerificationResult(GetRealPanResult result) {
154 unmask_controller_.OnVerificationResult(result); 156 unmask_controller_.OnVerificationResult(result);
155 } 157 }
156 158
157 void ChromeAutofillClient::ConfirmSaveCreditCard( 159 void ChromeAutofillClient::ConfirmSaveCreditCard(
158 const base::Closure& save_card_callback) { 160 const base::Closure& save_card_callback) {
159 AutofillCCInfoBarDelegate::Create( 161 AutofillCCInfoBarDelegate::Create(
160 InfoBarService::FromWebContents(web_contents()), this, 162 InfoBarService::FromWebContents(web_contents()), this,
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 new AutofillMsg_FirstUserGestureObservedInTab(routing_id())); 301 new AutofillMsg_FirstUserGestureObservedInTab(routing_id()));
300 } 302 }
301 303
302 void ChromeAutofillClient::LinkClicked(const GURL& url, 304 void ChromeAutofillClient::LinkClicked(const GURL& url,
303 WindowOpenDisposition disposition) { 305 WindowOpenDisposition disposition) {
304 web_contents()->OpenURL(content::OpenURLParams( 306 web_contents()->OpenURL(content::OpenURLParams(
305 url, content::Referrer(), disposition, ui::PAGE_TRANSITION_LINK, false)); 307 url, content::Referrer(), disposition, ui::PAGE_TRANSITION_LINK, false));
306 } 308 }
307 309
308 } // namespace autofill 310 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/chrome_autofill_client.h ('k') | chrome/browser/ui/autofill/create_card_unmask_prompt_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698