 Chromium Code Reviews
 Chromium Code Reviews Issue 710453002:
  [Autofill] Componentize AutofillCCInfoBarDelegate.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 710453002:
  [Autofill] Componentize AutofillCCInfoBarDelegate.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 "base/logging.h" | 7 #include "base/logging.h" | 
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" | 
| 9 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | |
| 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 9 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 
| 11 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" | 
| 12 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 11 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 
| 13 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" | 
| 14 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | 13 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | 
| 15 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 14 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 
| 16 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h" | 15 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h" | 
| 17 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" | 
| 18 #include "chrome/browser/ui/browser_finder.h" | 17 #include "chrome/browser/ui/browser_finder.h" | 
| 19 #include "chrome/browser/ui/browser_window.h" | 18 #include "chrome/browser/ui/browser_window.h" | 
| 20 #include "chrome/browser/ui/chrome_pages.h" | 19 #include "chrome/browser/ui/chrome_pages.h" | 
| 21 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 
| 22 #include "chrome/browser/webdata/web_data_service_factory.h" | 21 #include "chrome/browser/webdata/web_data_service_factory.h" | 
| 23 #include "chrome/common/url_constants.h" | 22 #include "chrome/common/url_constants.h" | 
| 24 #include "components/autofill/content/browser/content_autofill_driver.h" | 23 #include "components/autofill/content/browser/content_autofill_driver.h" | 
| 25 #include "components/autofill/content/common/autofill_messages.h" | 24 #include "components/autofill/content/common/autofill_messages.h" | 
| 25 #include "components/autofill/core/browser/autofill_cc_infobar_delegate.h" | |
| 26 #include "components/autofill/core/common/autofill_pref_names.h" | 26 #include "components/autofill/core/common/autofill_pref_names.h" | 
| 27 #include "components/infobars/core/infobar.h" | |
| 27 #include "content/public/browser/render_view_host.h" | 28 #include "content/public/browser/render_view_host.h" | 
| 28 #include "ui/gfx/rect.h" | 29 #include "ui/gfx/rect.h" | 
| 29 | 30 | 
| 30 #if defined(OS_ANDROID) | 31 #if defined(OS_ANDROID) | 
| 31 #include "chrome/browser/android/chromium_application.h" | 32 #include "chrome/browser/android/chromium_application.h" | 
| 32 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 33 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 
| 33 #else | 34 #else | 
| 34 #include "chrome/browser/ui/zoom/zoom_controller.h" | 35 #include "chrome/browser/ui/zoom/zoom_controller.h" | 
| 35 #endif | 36 #endif | 
| 36 | 37 | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 #if defined(OS_ANDROID) | 100 #if defined(OS_ANDROID) | 
| 100 chrome::android::ChromiumApplication::ShowAutofillSettings(); | 101 chrome::android::ChromiumApplication::ShowAutofillSettings(); | 
| 101 #else | 102 #else | 
| 102 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); | 103 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); | 
| 103 if (browser) | 104 if (browser) | 
| 104 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage); | 105 chrome::ShowSettingsSubPage(browser, chrome::kAutofillSubPage); | 
| 105 #endif // #if defined(OS_ANDROID) | 106 #endif // #if defined(OS_ANDROID) | 
| 106 } | 107 } | 
| 107 | 108 | 
| 108 void ChromeAutofillClient::ConfirmSaveCreditCard( | 109 void ChromeAutofillClient::ConfirmSaveCreditCard( | 
| 110 AutofillManager* autofill_manager, | |
| 109 const AutofillMetrics& metric_logger, | 111 const AutofillMetrics& metric_logger, | 
| 110 const base::Closure& save_card_callback) { | 112 const base::Closure& save_card_callback) { | 
| 111 InfoBarService* infobar_service = | |
| 112 InfoBarService::FromWebContents(web_contents_); | |
| 113 AutofillCCInfoBarDelegate::Create( | 113 AutofillCCInfoBarDelegate::Create( | 
| 114 infobar_service, &metric_logger, save_card_callback); | 114 InfoBarService::FromWebContents(web_contents_), autofill_manager, | 
| 115 &metric_logger, save_card_callback); | |
| 115 } | 116 } | 
| 
Ilya Sherman
2014/12/03 20:00:20
Does this entire method still need to be defined o
 
Pritam Nikam
2014/12/04 15:37:30
Done.
But I think, I didn't get this completely.
 | |
| 116 | 117 | 
| 117 bool ChromeAutofillClient::HasCreditCardScanFeature() { | 118 bool ChromeAutofillClient::HasCreditCardScanFeature() { | 
| 118 return CreditCardScannerController::HasCreditCardScanFeature(); | 119 return CreditCardScannerController::HasCreditCardScanFeature(); | 
| 119 } | 120 } | 
| 120 | 121 | 
| 121 void ChromeAutofillClient::ScanCreditCard( | 122 void ChromeAutofillClient::ScanCreditCard( | 
| 122 const CreditCardScanCallback& callback) { | 123 const CreditCardScanCallback& callback) { | 
| 123 CreditCardScannerController::ScanCreditCard(web_contents(), callback); | 124 CreditCardScannerController::ScanCreditCard(web_contents(), callback); | 
| 124 } | 125 } | 
| 125 | 126 | 
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 | 216 | 
| 216 void ChromeAutofillClient::DidFillOrPreviewField( | 217 void ChromeAutofillClient::DidFillOrPreviewField( | 
| 217 const base::string16& autofilled_value, | 218 const base::string16& autofilled_value, | 
| 218 const base::string16& profile_full_name) { | 219 const base::string16& profile_full_name) { | 
| 219 #if defined(OS_ANDROID) | 220 #if defined(OS_ANDROID) | 
| 220 AutofillLoggerAndroid::DidFillOrPreviewField(autofilled_value, | 221 AutofillLoggerAndroid::DidFillOrPreviewField(autofilled_value, | 
| 221 profile_full_name); | 222 profile_full_name); | 
| 222 #endif // defined(OS_ANDROID) | 223 #endif // defined(OS_ANDROID) | 
| 223 } | 224 } | 
| 224 | 225 | 
| 226 scoped_ptr<infobars::InfoBar> ChromeAutofillClient::CreateInfoBar( | |
| 227 scoped_ptr<ConfirmInfoBarDelegate> delegate) { | |
| 228 return ConfirmInfoBarDelegate::CreateInfoBar(delegate.Pass()); | |
| 229 } | |
| 230 | |
| 225 } // namespace autofill | 231 } // namespace autofill | 
| OLD | NEW |