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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 base::string16 type = TypeForDisplay(); | 504 base::string16 type = TypeForDisplay(); |
505 | 505 |
506 base::string16 digits = LastFourDigits(); | 506 base::string16 digits = LastFourDigits(); |
507 if (digits.empty()) | 507 if (digits.empty()) |
508 return type; | 508 return type; |
509 | 509 |
510 // TODO(estade): i18n? | 510 // TODO(estade): i18n? |
511 return type + base::string16(kMidlineEllipsis) + digits; | 511 return type + base::string16(kMidlineEllipsis) + digits; |
512 } | 512 } |
513 | 513 |
| 514 base::string16 CreditCard::BankNameAndLastFourDigits() const { |
| 515 base::string16 digits = LastFourDigits(); |
| 516 if (digits.empty()) |
| 517 return bank_name_; |
| 518 |
| 519 return bank_name_ + base::string16(kMidlineEllipsis) + digits; |
| 520 } |
| 521 |
514 base::string16 CreditCard::AbbreviatedExpirationDateForDisplay() const { | 522 base::string16 CreditCard::AbbreviatedExpirationDateForDisplay() const { |
515 base::string16 month = ExpirationMonthAsString(); | 523 base::string16 month = ExpirationMonthAsString(); |
516 base::string16 year = Expiration2DigitYearAsString(); | 524 base::string16 year = Expiration2DigitYearAsString(); |
517 return month.empty() || year.empty() | 525 return month.empty() || year.empty() |
518 ? base::string16() | 526 ? base::string16() |
519 : l10n_util::GetStringFUTF16( | 527 : l10n_util::GetStringFUTF16( |
520 IDS_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE_ABBR, month, year); | 528 IDS_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE_ABBR, month, year); |
521 } | 529 } |
522 | 530 |
523 void CreditCard::operator=(const CreditCard& credit_card) { | 531 void CreditCard::operator=(const CreditCard& credit_card) { |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 const char kDinersCard[] = "dinersCC"; | 935 const char kDinersCard[] = "dinersCC"; |
928 const char kDiscoverCard[] = "discoverCC"; | 936 const char kDiscoverCard[] = "discoverCC"; |
929 const char kGenericCard[] = "genericCC"; | 937 const char kGenericCard[] = "genericCC"; |
930 const char kJCBCard[] = "jcbCC"; | 938 const char kJCBCard[] = "jcbCC"; |
931 const char kMasterCard[] = "masterCardCC"; | 939 const char kMasterCard[] = "masterCardCC"; |
932 const char kMirCard[] = "mirCC"; | 940 const char kMirCard[] = "mirCC"; |
933 const char kUnionPay[] = "unionPayCC"; | 941 const char kUnionPay[] = "unionPayCC"; |
934 const char kVisaCard[] = "visaCC"; | 942 const char kVisaCard[] = "visaCC"; |
935 | 943 |
936 } // namespace autofill | 944 } // namespace autofill |
OLD | NEW |