Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/infobars/infobar_service.h" | |
| 18 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 17 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 21 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 22 #include "chrome/browser/signin/signin_manager_factory.h" | 21 #include "chrome/browser/signin/signin_manager_factory.h" |
| 23 #include "chrome/browser/signin/signin_promo_util.h" | 22 #include "chrome/browser/signin/signin_promo_util.h" |
| 24 #include "chrome/browser/sync/profile_sync_service_factory.h" | 23 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 25 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 24 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
| 26 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" | 25 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" |
| 27 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h" | 26 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 55 #include "chrome/browser/android/chrome_application.h" | 54 #include "chrome/browser/android/chrome_application.h" |
| 56 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 55 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" |
| 57 #else | 56 #else |
| 58 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 57 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 59 #include "components/zoom/zoom_controller.h" | 58 #include "components/zoom/zoom_controller.h" |
| 60 #endif | 59 #endif |
| 61 | 60 |
| 62 #if defined(OS_ANDROID) | 61 #if defined(OS_ANDROID) |
| 63 #include "base/android/context_utils.h" | 62 #include "base/android/context_utils.h" |
| 64 #include "chrome/browser/android/signin/signin_promo_util_android.h" | 63 #include "chrome/browser/android/signin/signin_promo_util_android.h" |
| 64 #include "chrome/browser/infobars/infobar_service.h" | |
| 65 #include "chrome/browser/ui/android/infobars/autofill_credit_card_filling_infoba r.h" | |
| 66 #include "components/autofill/core/browser/autofill_credit_card_filling_infobar_ delegate_mobile.h" | |
| 65 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m obile.h" | 67 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m obile.h" |
| 66 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h" | 68 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h" |
| 67 #include "components/infobars/core/infobar.h" | 69 #include "components/infobars/core/infobar.h" |
| 68 #include "content/public/browser/android/content_view_core.h" | 70 #include "content/public/browser/android/content_view_core.h" |
| 69 #endif | 71 #endif |
| 70 | 72 |
| 71 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); | 73 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); |
| 72 | 74 |
| 73 namespace autofill { | 75 namespace autofill { |
| 74 | 76 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 true, card, std::move(legal_message), callback)))); | 206 true, card, std::move(legal_message), callback)))); |
| 205 #else | 207 #else |
| 206 // Do lazy initialization of SaveCardBubbleControllerImpl. | 208 // Do lazy initialization of SaveCardBubbleControllerImpl. |
| 207 autofill::SaveCardBubbleControllerImpl::CreateForWebContents(web_contents()); | 209 autofill::SaveCardBubbleControllerImpl::CreateForWebContents(web_contents()); |
| 208 autofill::SaveCardBubbleControllerImpl* controller = | 210 autofill::SaveCardBubbleControllerImpl* controller = |
| 209 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents()); | 211 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents()); |
| 210 controller->ShowBubbleForUpload(card, std::move(legal_message), callback); | 212 controller->ShowBubbleForUpload(card, std::move(legal_message), callback); |
| 211 #endif | 213 #endif |
| 212 } | 214 } |
| 213 | 215 |
| 216 void ChromeAutofillClient::ConfirmCreditCardFillAssist( | |
| 217 const CreditCard& card, | |
| 218 const base::Closure& callback) { | |
| 219 #if defined(OS_ANDROID) | |
|
Peter Kasting
2016/08/03 02:25:40
If it's really true that desktop is "never going t
Mathieu
2016/08/03 18:34:44
I would like to keep the delegate inside component
| |
| 220 std::unique_ptr<infobars::InfoBar> infobar( | |
| 221 base::WrapUnique(new AutofillCreditCardFillingInfoBar( | |
|
Peter Kasting
2016/08/03 02:25:40
Nit: Use MakeUnique in newly-written code (WrapUni
Mathieu
2016/08/03 18:34:44
Done.
| |
| 222 base::WrapUnique(new AutofillCreditCardFillingInfoBarDelegateMobile( | |
| 223 card, callback))))); | |
| 224 if (infobar) { | |
| 225 infobars::InfoBar* added_infobar = | |
| 226 InfoBarService::FromWebContents(web_contents()) | |
| 227 ->AddInfoBar(std::move(infobar)); | |
| 228 if (added_infobar) { | |
| 229 static_cast<AutofillCreditCardFillingInfoBarDelegateMobile*>( | |
|
Peter Kasting
2016/08/03 02:25:40
Nit: Just save this raw pointer off when you first
Mathieu
2016/08/03 18:34:44
Done.
| |
| 230 added_infobar->delegate()) | |
| 231 ->set_was_shown(true); | |
| 232 } | |
| 233 } | |
| 234 #endif | |
| 235 } | |
| 236 | |
| 214 void ChromeAutofillClient::LoadRiskData( | 237 void ChromeAutofillClient::LoadRiskData( |
| 215 const base::Callback<void(const std::string&)>& callback) { | 238 const base::Callback<void(const std::string&)>& callback) { |
| 216 ::autofill::LoadRiskData(0, web_contents(), callback); | 239 ::autofill::LoadRiskData(0, web_contents(), callback); |
| 217 } | 240 } |
| 218 | 241 |
| 219 bool ChromeAutofillClient::HasCreditCardScanFeature() { | 242 bool ChromeAutofillClient::HasCreditCardScanFeature() { |
| 220 return CreditCardScannerController::HasCreditCardScanFeature(); | 243 return CreditCardScannerController::HasCreditCardScanFeature(); |
| 221 } | 244 } |
| 222 | 245 |
| 223 void ChromeAutofillClient::ScanCreditCard( | 246 void ChromeAutofillClient::ScanCreditCard( |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 chrome::FindBrowserWithWebContents(web_contents()) | 387 chrome::FindBrowserWithWebContents(web_contents()) |
| 365 ->window() | 388 ->window() |
| 366 ->ShowAvatarBubbleFromAvatarButton( | 389 ->ShowAvatarBubbleFromAvatarButton( |
| 367 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, | 390 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, |
| 368 signin::ManageAccountsParams(), | 391 signin::ManageAccountsParams(), |
| 369 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); | 392 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); |
| 370 #endif | 393 #endif |
| 371 } | 394 } |
| 372 | 395 |
| 373 } // namespace autofill | 396 } // namespace autofill |
| OLD | NEW |