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

Unified Diff: chrome/browser/autofill/autofill_cc_infobar_delegate.cc

Issue 12378055: Make autofill stop depending on InfoBarService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autofill/autofill_cc_infobar_delegate.h ('k') | chrome/browser/autofill/autofill_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_cc_infobar_delegate.cc
diff --git a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc b/chrome/browser/autofill/autofill_cc_infobar_delegate.cc
index 8ecc497639d8a2be976ac04cfb950edc6a28b191..3c2c292c326e6bd48208bdd7e185461dca6cc08d 100644
--- a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc
+++ b/chrome/browser/autofill/autofill_cc_infobar_delegate.cc
@@ -20,26 +20,31 @@
// static
void AutofillCCInfoBarDelegate::Create(
InfoBarService* infobar_service,
- const CreditCard* credit_card,
- PersonalDataManager* personal_data,
- const AutofillMetrics* metric_logger) {
+ const AutofillMetrics* metric_logger,
+ const base::Closure& save_card_callback) {
infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
- new AutofillCCInfoBarDelegate(infobar_service, credit_card, personal_data,
- metric_logger)));
+ new AutofillCCInfoBarDelegate(
+ infobar_service, metric_logger, save_card_callback)));
+ metric_logger->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN);
+}
+
+// static
+scoped_ptr<ConfirmInfoBarDelegate> AutofillCCInfoBarDelegate::CreateForTesting(
+ const AutofillMetrics* metric_logger,
+ const base::Closure& save_card_callback) {
+ metric_logger->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN);
+ return scoped_ptr<ConfirmInfoBarDelegate>(
+ new AutofillCCInfoBarDelegate(NULL, metric_logger, save_card_callback));
}
AutofillCCInfoBarDelegate::AutofillCCInfoBarDelegate(
InfoBarService* infobar_service,
- const CreditCard* credit_card,
- PersonalDataManager* personal_data,
- const AutofillMetrics* metric_logger)
+ const AutofillMetrics* metric_logger,
+ const base::Closure& save_card_callback)
: ConfirmInfoBarDelegate(infobar_service),
- credit_card_(credit_card),
- personal_data_(personal_data),
metric_logger_(metric_logger),
- had_user_interaction_(false) {
- metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN);
-}
+ save_card_callback_(save_card_callback),
+ had_user_interaction_(false) {}
AutofillCCInfoBarDelegate::~AutofillCCInfoBarDelegate() {
if (!had_user_interaction_)
@@ -85,7 +90,8 @@ string16 AutofillCCInfoBarDelegate::GetButtonLabel(InfoBarButton button) const {
}
bool AutofillCCInfoBarDelegate::Accept() {
- personal_data_->SaveImportedCreditCard(*credit_card_);
+ save_card_callback_.Run();
+ save_card_callback_.Reset();
Justin Donnelly 2016/03/09 03:33:35 Question arose about this arose in https://coderev
LogUserAction(AutofillMetrics::INFOBAR_ACCEPTED);
return true;
}
« no previous file with comments | « chrome/browser/autofill/autofill_cc_infobar_delegate.h ('k') | chrome/browser/autofill/autofill_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698