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

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

Issue 2789843004: [Payments] Upload card UI now has a CVC prompt (Closed)
Patch Set: Address code review comment Created 3 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
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "chrome/browser/autofill/personal_data_manager_factory.h" 14 #include "chrome/browser/autofill/personal_data_manager_factory.h"
15 #include "chrome/browser/autofill/risk_util.h" 15 #include "chrome/browser/autofill/risk_util.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/password_manager/chrome_password_manager_client.h" 17 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/profiles/profile_manager.h" 19 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
21 #include "chrome/browser/signin/signin_manager_factory.h" 21 #include "chrome/browser/signin/signin_manager_factory.h"
22 #include "chrome/browser/signin/signin_promo_util.h" 22 #include "chrome/browser/signin/signin_promo_util.h"
23 #include "chrome/browser/sync/profile_sync_service_factory.h" 23 #include "chrome/browser/sync/profile_sync_service_factory.h"
24 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" 24 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
25 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" 25 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h"
26 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h" 26 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h"
27 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h"
28 #include "chrome/browser/ui/browser_finder.h" 27 #include "chrome/browser/ui/browser_finder.h"
29 #include "chrome/browser/ui/chrome_pages.h" 28 #include "chrome/browser/ui/chrome_pages.h"
30 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 29 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
31 #include "chrome/browser/web_data_service_factory.h" 30 #include "chrome/browser/web_data_service_factory.h"
32 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
33 #include "components/autofill/content/browser/content_autofill_driver.h" 32 #include "components/autofill/content/browser/content_autofill_driver.h"
34 #include "components/autofill/content/browser/content_autofill_driver_factory.h" 33 #include "components/autofill/content/browser/content_autofill_driver_factory.h"
35 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h" 34 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h"
36 #include "components/autofill/core/common/autofill_pref_names.h" 35 #include "components/autofill/core/common/autofill_pref_names.h"
37 #include "components/autofill/core/common/autofill_switches.h" 36 #include "components/autofill/core/common/autofill_switches.h"
(...skipping 15 matching lines...) Expand all
53 #include "chrome/browser/android/signin/signin_promo_util_android.h" 52 #include "chrome/browser/android/signin/signin_promo_util_android.h"
54 #include "chrome/browser/infobars/infobar_service.h" 53 #include "chrome/browser/infobars/infobar_service.h"
55 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" 54 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h"
56 #include "chrome/browser/ui/android/infobars/autofill_credit_card_filling_infoba r.h" 55 #include "chrome/browser/ui/android/infobars/autofill_credit_card_filling_infoba r.h"
57 #include "components/autofill/core/browser/autofill_credit_card_filling_infobar_ delegate_mobile.h" 56 #include "components/autofill/core/browser/autofill_credit_card_filling_infobar_ delegate_mobile.h"
58 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m obile.h" 57 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m obile.h"
59 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h" 58 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h"
60 #include "components/infobars/core/infobar.h" 59 #include "components/infobars/core/infobar.h"
61 #include "content/public/browser/android/content_view_core.h" 60 #include "content/public/browser/android/content_view_core.h"
62 #else // !OS_ANDROID 61 #else // !OS_ANDROID
62 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h"
63 #include "chrome/browser/ui/browser.h" 63 #include "chrome/browser/ui/browser.h"
64 #include "chrome/browser/ui/browser_commands.h" 64 #include "chrome/browser/ui/browser_commands.h"
65 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 65 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
66 #include "components/zoom/zoom_controller.h" 66 #include "components/zoom/zoom_controller.h"
67 #endif 67 #endif
68 68
69 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); 69 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient);
70 70
71 namespace autofill { 71 namespace autofill {
72 72
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 145 }
146 146
147 rappor::RapporServiceImpl* ChromeAutofillClient::GetRapporServiceImpl() { 147 rappor::RapporServiceImpl* ChromeAutofillClient::GetRapporServiceImpl() {
148 return g_browser_process->rappor_service(); 148 return g_browser_process->rappor_service();
149 } 149 }
150 150
151 ukm::UkmService* ChromeAutofillClient::GetUkmService() { 151 ukm::UkmService* ChromeAutofillClient::GetUkmService() {
152 return g_browser_process->ukm_service(); 152 return g_browser_process->ukm_service();
153 } 153 }
154 154
155 SaveCardBubbleController* ChromeAutofillClient::GetSaveCardBubbleController() {
156 #if defined(OS_ANDROID)
157 return nullptr;
158 #else
159 return SaveCardBubbleControllerImpl::FromWebContents(web_contents());
160 #endif
161 }
162
155 void ChromeAutofillClient::ShowAutofillSettings() { 163 void ChromeAutofillClient::ShowAutofillSettings() {
156 #if defined(OS_ANDROID) 164 #if defined(OS_ANDROID)
157 chrome::android::PreferencesLauncher::ShowAutofillSettings(); 165 chrome::android::PreferencesLauncher::ShowAutofillSettings();
158 #else 166 #else
159 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); 167 Browser* browser = chrome::FindBrowserWithWebContents(web_contents());
160 if (browser) 168 if (browser)
161 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage); 169 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage);
162 #endif // #if defined(OS_ANDROID) 170 #endif // #if defined(OS_ANDROID)
163 } 171 }
164 172
(...skipping 26 matching lines...) Expand all
191 web_contents()); 199 web_contents());
192 autofill::SaveCardBubbleControllerImpl* controller = 200 autofill::SaveCardBubbleControllerImpl* controller =
193 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents()); 201 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents());
194 controller->ShowBubbleForLocalSave(card, callback); 202 controller->ShowBubbleForLocalSave(card, callback);
195 #endif 203 #endif
196 } 204 }
197 205
198 void ChromeAutofillClient::ConfirmSaveCreditCardToCloud( 206 void ChromeAutofillClient::ConfirmSaveCreditCardToCloud(
199 const CreditCard& card, 207 const CreditCard& card,
200 std::unique_ptr<base::DictionaryValue> legal_message, 208 std::unique_ptr<base::DictionaryValue> legal_message,
209 bool should_cvc_be_requested,
201 const base::Closure& callback) { 210 const base::Closure& callback) {
202 #if defined(OS_ANDROID) 211 #if defined(OS_ANDROID)
203 InfoBarService::FromWebContents(web_contents()) 212 InfoBarService::FromWebContents(web_contents())
204 ->AddInfoBar(CreateSaveCardInfoBarMobile( 213 ->AddInfoBar(CreateSaveCardInfoBarMobile(
205 base::MakeUnique<AutofillSaveCardInfoBarDelegateMobile>( 214 base::MakeUnique<AutofillSaveCardInfoBarDelegateMobile>(
206 true, card, std::move(legal_message), callback))); 215 true, card, std::move(legal_message), callback)));
207 #else 216 #else
208 // Do lazy initialization of SaveCardBubbleControllerImpl. 217 // Do lazy initialization of SaveCardBubbleControllerImpl.
209 autofill::SaveCardBubbleControllerImpl::CreateForWebContents(web_contents()); 218 autofill::SaveCardBubbleControllerImpl::CreateForWebContents(web_contents());
210 autofill::SaveCardBubbleControllerImpl* controller = 219 autofill::SaveCardBubbleControllerImpl* controller =
211 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents()); 220 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents());
212 controller->ShowBubbleForUpload(card, std::move(legal_message), callback); 221 controller->ShowBubbleForUpload(card, std::move(legal_message),
222 should_cvc_be_requested, callback);
213 #endif 223 #endif
214 } 224 }
215 225
216 void ChromeAutofillClient::ConfirmCreditCardFillAssist( 226 void ChromeAutofillClient::ConfirmCreditCardFillAssist(
217 const CreditCard& card, 227 const CreditCard& card,
218 const base::Closure& callback) { 228 const base::Closure& callback) {
219 #if defined(OS_ANDROID) 229 #if defined(OS_ANDROID)
220 auto infobar_delegate = 230 auto infobar_delegate =
221 base::MakeUnique<AutofillCreditCardFillingInfoBarDelegateMobile>( 231 base::MakeUnique<AutofillCreditCardFillingInfoBarDelegateMobile>(
222 card, callback); 232 card, callback);
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // directly. 399 // directly.
390 const GURL kSecurityIndicatorHelpCenterUrl( 400 const GURL kSecurityIndicatorHelpCenterUrl(
391 "https://support.google.com/chrome/?p=ui_security_indicator"); 401 "https://support.google.com/chrome/?p=ui_security_indicator");
392 web_contents()->OpenURL(content::OpenURLParams( 402 web_contents()->OpenURL(content::OpenURLParams(
393 GURL(kSecurityIndicatorHelpCenterUrl), content::Referrer(), 403 GURL(kSecurityIndicatorHelpCenterUrl), content::Referrer(),
394 WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, 404 WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK,
395 false /* is_renderer_initiated */)); 405 false /* is_renderer_initiated */));
396 } 406 }
397 407
398 } // namespace autofill 408 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/chrome_autofill_client.h ('k') | chrome/browser/ui/autofill/save_card_bubble_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698