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) | |
| 220 auto infobar_delegate = | |
| 221 base::MakeUnique<AutofillCreditCardFillingInfoBarDelegateMobile>( | |
| 222 card, callback); | |
| 223 auto* raw_delegate = infobar_delegate.get(); | |
| 224 std::unique_ptr<infobars::InfoBar> infobar( | |
| 225 base::MakeUnique<AutofillCreditCardFillingInfoBar>( | |
| 226 std::move(infobar_delegate))); | |
|
Evan Stade
2016/08/04 13:01:48
nit: all these std:: and base:: and autos make thi
Mathieu
2016/08/04 15:46:13
got rid of one std::move and std::unique_ptr<..> b
| |
| 227 if (InfoBarService::FromWebContents(web_contents())->AddInfoBar( | |
| 228 std::move(infobar))) | |
|
Evan Stade
2016/08/04 13:01:48
nit: curlies
Mathieu
2016/08/04 15:46:13
Done.
| |
| 229 raw_delegate->set_was_shown(); | |
| 230 #endif | |
| 231 } | |
| 232 | |
| 214 void ChromeAutofillClient::LoadRiskData( | 233 void ChromeAutofillClient::LoadRiskData( |
| 215 const base::Callback<void(const std::string&)>& callback) { | 234 const base::Callback<void(const std::string&)>& callback) { |
| 216 ::autofill::LoadRiskData(0, web_contents(), callback); | 235 ::autofill::LoadRiskData(0, web_contents(), callback); |
| 217 } | 236 } |
| 218 | 237 |
| 219 bool ChromeAutofillClient::HasCreditCardScanFeature() { | 238 bool ChromeAutofillClient::HasCreditCardScanFeature() { |
| 220 return CreditCardScannerController::HasCreditCardScanFeature(); | 239 return CreditCardScannerController::HasCreditCardScanFeature(); |
| 221 } | 240 } |
| 222 | 241 |
| 223 void ChromeAutofillClient::ScanCreditCard( | 242 void ChromeAutofillClient::ScanCreditCard( |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 chrome::FindBrowserWithWebContents(web_contents()) | 383 chrome::FindBrowserWithWebContents(web_contents()) |
| 365 ->window() | 384 ->window() |
| 366 ->ShowAvatarBubbleFromAvatarButton( | 385 ->ShowAvatarBubbleFromAvatarButton( |
| 367 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, | 386 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, |
| 368 signin::ManageAccountsParams(), | 387 signin::ManageAccountsParams(), |
| 369 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); | 388 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); |
| 370 #endif | 389 #endif |
| 371 } | 390 } |
| 372 | 391 |
| 373 } // namespace autofill | 392 } // namespace autofill |
| OLD | NEW |