| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/credit_card.h" | 5 #include "components/autofill/core/browser/credit_card.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 return number; | 494 return number; |
| 495 | 495 |
| 496 return number.substr(number.size() - kNumLastDigits, kNumLastDigits); | 496 return number.substr(number.size() - kNumLastDigits, kNumLastDigits); |
| 497 } | 497 } |
| 498 | 498 |
| 499 base::string16 CreditCard::TypeForDisplay() const { | 499 base::string16 CreditCard::TypeForDisplay() const { |
| 500 return CreditCard::TypeForDisplay(type_); | 500 return CreditCard::TypeForDisplay(type_); |
| 501 } | 501 } |
| 502 | 502 |
| 503 base::string16 CreditCard::TypeAndLastFourDigits() const { | 503 base::string16 CreditCard::TypeAndLastFourDigits() const { |
| 504 base::string16 type = TypeForDisplay(); | 504 base::string16 card_type; |
| 505 if (IsAutofillCreditCardBankNameDisplayExperimentEnabled()) { |
| 506 card_type = bank_name(); |
| 507 } else { |
| 508 card_type = TypeForDisplay(); |
| 509 } |
| 505 | 510 |
| 506 base::string16 digits = LastFourDigits(); | 511 base::string16 digits = LastFourDigits(); |
| 507 if (digits.empty()) | 512 if (digits.empty()) |
| 508 return type; | 513 return card_type; |
| 509 | 514 |
| 510 // TODO(estade): i18n? | 515 // TODO(estade): i18n? |
| 511 return type + base::string16(kMidlineEllipsis) + digits; | 516 return card_type + base::string16(kMidlineEllipsis) + digits; |
| 512 } | 517 } |
| 513 | 518 |
| 514 base::string16 CreditCard::AbbreviatedExpirationDateForDisplay() const { | 519 base::string16 CreditCard::AbbreviatedExpirationDateForDisplay() const { |
| 515 base::string16 month = ExpirationMonthAsString(); | 520 base::string16 month = ExpirationMonthAsString(); |
| 516 base::string16 year = Expiration2DigitYearAsString(); | 521 base::string16 year = Expiration2DigitYearAsString(); |
| 517 return month.empty() || year.empty() | 522 return month.empty() || year.empty() |
| 518 ? base::string16() | 523 ? base::string16() |
| 519 : l10n_util::GetStringFUTF16( | 524 : l10n_util::GetStringFUTF16( |
| 520 IDS_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE_ABBR, month, year); | 525 IDS_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE_ABBR, month, year); |
| 521 } | 526 } |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 const char kDinersCard[] = "dinersCC"; | 932 const char kDinersCard[] = "dinersCC"; |
| 928 const char kDiscoverCard[] = "discoverCC"; | 933 const char kDiscoverCard[] = "discoverCC"; |
| 929 const char kGenericCard[] = "genericCC"; | 934 const char kGenericCard[] = "genericCC"; |
| 930 const char kJCBCard[] = "jcbCC"; | 935 const char kJCBCard[] = "jcbCC"; |
| 931 const char kMasterCard[] = "masterCardCC"; | 936 const char kMasterCard[] = "masterCardCC"; |
| 932 const char kMirCard[] = "mirCC"; | 937 const char kMirCard[] = "mirCC"; |
| 933 const char kUnionPay[] = "unionPayCC"; | 938 const char kUnionPay[] = "unionPayCC"; |
| 934 const char kVisaCard[] = "visaCC"; | 939 const char kVisaCard[] = "visaCC"; |
| 935 | 940 |
| 936 } // namespace autofill | 941 } // namespace autofill |
| OLD | NEW |