Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/autofill/autofill_cc_import_confirmation_handler.h" | |
| 6 | |
| 7 #include "chrome/browser/autofill/autofill_metrics.h" | |
| 8 #include "chrome/browser/autofill/personal_data_manager.h" | |
| 9 | |
| 10 namespace autofill { | |
| 11 | |
| 12 AutofillCCImportConfirmationHandler::AutofillCCImportConfirmationHandler( | |
| 13 scoped_ptr<const CreditCard> credit_card, | |
| 14 PersonalDataManager* personal_data, | |
| 15 const AutofillMetrics* metric_logger) | |
| 16 : credit_card_(credit_card.Pass()), | |
| 17 personal_data_(personal_data), | |
| 18 metric_logger_(metric_logger), | |
| 19 had_user_interaction_(false) {} | |
| 20 | |
| 21 AutofillCCImportConfirmationHandler::~AutofillCCImportConfirmationHandler() { | |
| 22 if (!had_user_interaction_) | |
|
Ilya Sherman
2013/03/05 02:50:39
nit: Curly braces
kaiwang
2013/03/05 03:57:24
Done.
| |
| 23 metric_logger_->LogCreditCardInfoBarMetric( | |
| 24 AutofillMetrics::INFOBAR_IGNORED); | |
| 25 } | |
| 26 | |
| 27 void AutofillCCImportConfirmationHandler::DidShow() { | |
| 28 LOG(INFO) << "DidShow"; | |
|
Ilya Sherman
2013/03/05 02:50:39
nit: Remove this.
kaiwang
2013/03/05 03:57:24
Done.
| |
| 29 metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN); | |
| 30 } | |
| 31 | |
| 32 void AutofillCCImportConfirmationHandler::DidAccept() { | |
| 33 DCHECK(!had_user_interaction_); | |
| 34 | |
| 35 personal_data_->SaveImportedCreditCard(*credit_card_); | |
| 36 metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_ACCEPTED); | |
| 37 had_user_interaction_ = true; | |
| 38 } | |
| 39 | |
| 40 void AutofillCCImportConfirmationHandler::DidCancel() { | |
| 41 DCHECK(!had_user_interaction_); | |
| 42 metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_DENIED); | |
| 43 had_user_interaction_ = true; | |
| 44 } | |
| 45 | |
| 46 void AutofillCCImportConfirmationHandler::DidDismiss() { | |
| 47 DCHECK(!had_user_interaction_); | |
| 48 metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_DENIED); | |
| 49 had_user_interaction_ = true; | |
| 50 } | |
| 51 | |
| 52 } // namespace autofill | |
| OLD | NEW |