OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/autofill/core/browser/autofill_credit_card_filling_infobar_
delegate_mobile.h" | 5 #include "components/autofill/core/browser/autofill_credit_card_filling_infobar_
delegate_mobile.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "components/autofill/core/browser/credit_card.h" | 8 #include "components/autofill/core/browser/credit_card.h" |
9 #include "components/autofill/core/common/autofill_constants.h" | 9 #include "components/autofill/core/common/autofill_constants.h" |
10 #include "components/grit/components_scaled_resources.h" | 10 #include "components/grit/components_scaled_resources.h" |
11 #include "components/infobars/core/infobar_delegate.h" | 11 #include "components/infobars/core/infobar_delegate.h" |
12 #include "components/strings/grit/components_strings.h" | 12 #include "components/strings/grit/components_strings.h" |
13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
14 | 14 |
15 namespace autofill { | 15 namespace autofill { |
16 | 16 |
17 AutofillCreditCardFillingInfoBarDelegateMobile:: | 17 AutofillCreditCardFillingInfoBarDelegateMobile:: |
18 AutofillCreditCardFillingInfoBarDelegateMobile( | 18 AutofillCreditCardFillingInfoBarDelegateMobile( |
19 const CreditCard& card, | 19 const CreditCard& card, |
20 const base::Closure& card_filling_callback) | 20 const base::Closure& card_filling_callback) |
21 : ConfirmInfoBarDelegate(), | 21 : ConfirmInfoBarDelegate(), |
22 card_filling_callback_(card_filling_callback), | 22 card_filling_callback_(card_filling_callback), |
23 had_user_interaction_(false), | 23 had_user_interaction_(false), |
24 was_shown_(false), | 24 was_shown_(false), |
25 issuer_icon_id_(CreditCard::IconResourceId(card.type())), | 25 issuer_icon_id_(CreditCard::IconResourceId(card.network())), |
26 #if defined(OS_IOS) | 26 #if defined(OS_IOS) |
27 card_label_(card.TypeAndLastFourDigits()), | 27 card_label_(card.NetworkAndLastFourDigits()), |
28 #else | 28 #else |
29 card_label_(base::string16(kMidlineEllipsis) + card.LastFourDigits()), | 29 card_label_(base::string16(kMidlineEllipsis) + card.LastFourDigits()), |
30 #endif | 30 #endif |
31 card_sub_label_(card.AbbreviatedExpirationDateForDisplay()) { | 31 card_sub_label_(card.AbbreviatedExpirationDateForDisplay()) { |
32 } | 32 } |
33 | 33 |
34 AutofillCreditCardFillingInfoBarDelegateMobile:: | 34 AutofillCreditCardFillingInfoBarDelegateMobile:: |
35 ~AutofillCreditCardFillingInfoBarDelegateMobile() { | 35 ~AutofillCreditCardFillingInfoBarDelegateMobile() { |
36 if (was_shown_) { | 36 if (was_shown_) { |
37 AutofillMetrics::LogCreditCardFillingInfoBarMetric( | 37 AutofillMetrics::LogCreditCardFillingInfoBarMetric( |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 void AutofillCreditCardFillingInfoBarDelegateMobile::LogUserAction( | 92 void AutofillCreditCardFillingInfoBarDelegateMobile::LogUserAction( |
93 AutofillMetrics::InfoBarMetric user_action) { | 93 AutofillMetrics::InfoBarMetric user_action) { |
94 DCHECK(!had_user_interaction_); | 94 DCHECK(!had_user_interaction_); |
95 | 95 |
96 AutofillMetrics::LogCreditCardFillingInfoBarMetric(user_action); | 96 AutofillMetrics::LogCreditCardFillingInfoBarMetric(user_action); |
97 had_user_interaction_ = true; | 97 had_user_interaction_ = true; |
98 } | 98 } |
99 | 99 |
100 } // namespace autofill | 100 } // namespace autofill |
OLD | NEW |