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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 base::string16 digits = LastFourDigits(); | 496 base::string16 digits = LastFourDigits(); |
497 if (digits.empty()) | 497 if (digits.empty()) |
498 return type; | 498 return type; |
499 | 499 |
500 // The separator character is a non breaking space and a horizontal midline | 500 // The separator character is a non breaking space and a horizontal midline |
501 // ellipsis. | 501 // ellipsis. |
502 // TODO(estade): i18n? | 502 // TODO(estade): i18n? |
503 return type + base::UTF8ToUTF16("\xC2\xA0\xE2\x8B\xAF") + digits; | 503 return type + base::UTF8ToUTF16("\xC2\xA0\xE2\x8B\xAF") + digits; |
504 } | 504 } |
505 | 505 |
| 506 base::string16 CreditCard::AbbreviatedExpirationDateForDisplay() const { |
| 507 base::string16 month = ExpirationMonthAsString(); |
| 508 base::string16 year = Expiration2DigitYearAsString(); |
| 509 return month.empty() || year.empty() |
| 510 ? base::string16() |
| 511 : l10n_util::GetStringFUTF16( |
| 512 IDS_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE_ABBR, month, year); |
| 513 } |
| 514 |
506 void CreditCard::operator=(const CreditCard& credit_card) { | 515 void CreditCard::operator=(const CreditCard& credit_card) { |
507 set_use_count(credit_card.use_count()); | 516 set_use_count(credit_card.use_count()); |
508 set_use_date(credit_card.use_date()); | 517 set_use_date(credit_card.use_date()); |
509 set_modification_date(credit_card.modification_date()); | 518 set_modification_date(credit_card.modification_date()); |
510 | 519 |
511 if (this == &credit_card) | 520 if (this == &credit_card) |
512 return; | 521 return; |
513 | 522 |
514 record_type_ = credit_card.record_type_; | 523 record_type_ = credit_card.record_type_; |
515 number_ = credit_card.number_; | 524 number_ = credit_card.number_; |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 const char kAmericanExpressCard[] = "americanExpressCC"; | 799 const char kAmericanExpressCard[] = "americanExpressCC"; |
791 const char kDinersCard[] = "dinersCC"; | 800 const char kDinersCard[] = "dinersCC"; |
792 const char kDiscoverCard[] = "discoverCC"; | 801 const char kDiscoverCard[] = "discoverCC"; |
793 const char kGenericCard[] = "genericCC"; | 802 const char kGenericCard[] = "genericCC"; |
794 const char kJCBCard[] = "jcbCC"; | 803 const char kJCBCard[] = "jcbCC"; |
795 const char kMasterCard[] = "masterCardCC"; | 804 const char kMasterCard[] = "masterCardCC"; |
796 const char kUnionPay[] = "unionPayCC"; | 805 const char kUnionPay[] = "unionPayCC"; |
797 const char kVisaCard[] = "visaCC"; | 806 const char kVisaCard[] = "visaCC"; |
798 | 807 |
799 } // namespace autofill | 808 } // namespace autofill |
OLD | NEW |