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

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: Rebase 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..cef4cfe3d9e84fd17ac5f863a2e5f451fdef79ad
--- /dev/null
+++ b/chrome/browser/autofill/autofill_cc_import_confirmation_handler.cc
@@ -0,0 +1,52 @@
+// 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 02:50:39 nit: Curly braces
kaiwang 2013/03/05 03:57:24 Done.
+ metric_logger_->LogCreditCardInfoBarMetric(
+ AutofillMetrics::INFOBAR_IGNORED);
+}
+
+void AutofillCCImportConfirmationHandler::DidShow() {
+ LOG(INFO) << "DidShow";
Ilya Sherman 2013/03/05 02:50:39 nit: Remove this.
kaiwang 2013/03/05 03:57:24 Done.
+ 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