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

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

Issue 12378055: Make autofill stop depending on InfoBarService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 7 years, 10 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
Index: chrome/browser/autofill/autofill_cc_import_confirmation_handler.cc
diff --git a/chrome/browser/autofill/autofill_cc_import_confirmation_handler.cc b/chrome/browser/autofill/autofill_cc_import_confirmation_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..53cc94841ea242bfa29ba36fe497cef515bb4ddc
--- /dev/null
+++ b/chrome/browser/autofill/autofill_cc_import_confirmation_handler.cc
@@ -0,0 +1,51 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/autofill/autofill_cc_import_confirmation_handler.h"
+
+#include "chrome/browser/autofill/autofill_metrics.h"
+#include "chrome/browser/autofill/personal_data_manager.h"
+
+namespace autofill {
+
+AutofillCCImportConfirmationHandler::AutofillCCImportConfirmationHandler(
+ scoped_ptr<const CreditCard> credit_card,
+ PersonalDataManager* personal_data,
+ const AutofillMetrics* metric_logger)
+ : credit_card_(credit_card.Pass()),
+ personal_data_(personal_data),
+ metric_logger_(metric_logger),
+ had_user_interaction_(false) {}
+
+AutofillCCImportConfirmationHandler::~AutofillCCImportConfirmationHandler() {
+ if (!had_user_interaction_)
Ilya Sherman 2013/03/05 04:37:39 nit: Still missing curly braces...
kaiwang 2013/03/05 18:38:16 Oops, forgot to commit
+ metric_logger_->LogCreditCardInfoBarMetric(
+ AutofillMetrics::INFOBAR_IGNORED);
+}
+
+void AutofillCCImportConfirmationHandler::DidShow() {
+ metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN);
+}
+
+void AutofillCCImportConfirmationHandler::DidAccept() {
+ DCHECK(!had_user_interaction_);
+
+ personal_data_->SaveImportedCreditCard(*credit_card_);
+ metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_ACCEPTED);
+ had_user_interaction_ = true;
+}
+
+void AutofillCCImportConfirmationHandler::DidCancel() {
+ DCHECK(!had_user_interaction_);
+ metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_DENIED);
+ had_user_interaction_ = true;
+}
+
+void AutofillCCImportConfirmationHandler::DidDismiss() {
+ DCHECK(!had_user_interaction_);
+ metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_DENIED);
+ had_user_interaction_ = true;
+}
+
+} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698