Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(629)

Unified Diff: components/autofill/core/browser/credit_card.cc

Issue 1540423004: Add card details and legal message to Android save credit card infobar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial draft Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/credit_card.cc
diff --git a/components/autofill/core/browser/credit_card.cc b/components/autofill/core/browser/credit_card.cc
index 232fca5dc92e1fc7b6abd0db7c57add4e5e1eac9..92b4d806a908571786076b29b015a785a32f3e2a 100644
--- a/components/autofill/core/browser/credit_card.cc
+++ b/components/autofill/core/browser/credit_card.cc
@@ -486,6 +486,14 @@ base::string16 CreditCard::LastFourDigits() const {
return number.substr(number.size() - kNumLastDigits, kNumLastDigits);
}
+base::string16 CreditCard::LastFourDigitsForDisplay() const {
+ base::string16 digits = LastFourDigits();
+ // Prepend the midline horizontal ellipsis (U+22EF).
+ // TODO(estade): i18n?
+ return digits.empty() ? base::string16()
+ : base::UTF8ToUTF16("\xE2\x8B\xAF") + digits;
+}
+
base::string16 CreditCard::TypeForDisplay() const {
return CreditCard::TypeForDisplay(type_);
}
@@ -493,14 +501,21 @@ base::string16 CreditCard::TypeForDisplay() const {
base::string16 CreditCard::TypeAndLastFourDigits() const {
Justin Donnelly 2015/12/30 18:06:37 Change to TypeAndLastFourDigitsForDisplay for cons
please use gerrit instead 2016/01/07 01:39:25 Done.
base::string16 type = TypeForDisplay();
- base::string16 digits = LastFourDigits();
+ base::string16 digits = LastFourDigitsForDisplay();
if (digits.empty())
return type;
- // The separator character is a non breaking space and a horizontal midline
- // ellipsis.
- // TODO(estade): i18n?
- return type + base::UTF8ToUTF16("\xC2\xA0\xE2\x8B\xAF") + digits;
+ // The separator character is a non breaking space.
+ return type + base::UTF8ToUTF16("\xC2\xA0") + digits;
+}
+
+base::string16 CreditCard::AbbreviatedExpirationDateForDisplay() const {
+ base::string16 month = ExpirationMonthAsString();
+ base::string16 year = Expiration2DigitYearAsString();
+ return month.empty() || year.empty()
+ ? base::string16()
+ : l10n_util::GetStringFUTF16(
+ IDS_AUTOFILL_CREDIT_CARD_EXPIRATION_DATE_ABBR, month, year);
}
void CreditCard::operator=(const CreditCard& credit_card) {

Powered by Google App Engine
This is Rietveld 408576698