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

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

Issue 2711543002: Experiment to add bank name in autofill ui. (Closed)
Patch Set: Add comments about the flag Created 3 years, 10 months 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 13bd6abd442531ce0ad65a76380c81fdbe182d63..d20e4a6ca844ded7d29a9168caa58ef400dbc721 100644
--- a/components/autofill/core/browser/credit_card.cc
+++ b/components/autofill/core/browser/credit_card.cc
@@ -511,6 +511,22 @@ base::string16 CreditCard::TypeAndLastFourDigits() const {
return type + base::string16(kMidlineEllipsis) + digits;
}
+base::string16 CreditCard::BankNameAndLastFourDigits() const {
+ base::string16 digits = LastFourDigits();
+ // TODO(szhangcs) The length to show here is limited, so we are going to do a
+ // mapping from long bank names to short bank names. We will do the mapping
Mathieu 2017/03/31 18:25:10 This comment is too detailed for the chromium code
Shanfeng 2017/04/12 01:58:59 Done.
+ // after Bin Service verified what are the Bin ranges that have good data
+ // quality.
+ if (digits.empty())
+ return ASCIIToUTF16(bank_name_);
+ size_t bank_name_length = 8;
Jared Saul 2017/03/03 23:40:09 Any particular reason behind the choice of 8? I'm
Shanfeng 2017/03/04 00:01:08 No perticular reason. 8 looks long enough on the n
+ if (bank_name_.size() < bank_name_length) {
+ bank_name_length = bank_name_.size();
+ }
+ return ASCIIToUTF16(bank_name_.substr(0, bank_name_length)) +
Mathieu 2017/03/31 18:25:10 A truncate is not great. Have a look at https://cs
Shanfeng 2017/04/12 01:58:59 We will ensure the max length of bank name will be
+ base::string16(kMidlineEllipsis) + digits;
+}
+
base::string16 CreditCard::AbbreviatedExpirationDateForDisplay() const {
base::string16 month = ExpirationMonthAsString();
base::string16 year = Expiration2DigitYearAsString();
@@ -537,6 +553,7 @@ void CreditCard::operator=(const CreditCard& credit_card) {
server_id_ = credit_card.server_id_;
server_status_ = credit_card.server_status_;
billing_address_id_ = credit_card.billing_address_id_;
+ bank_name_ = credit_card.bank_name_;
set_guid(credit_card.guid());
set_origin(credit_card.origin());
@@ -652,6 +669,10 @@ int CreditCard::Compare(const CreditCard& credit_card) const {
if (comparison != 0)
return comparison;
+ comparison = bank_name_.compare(credit_card.bank_name_);
+ if (comparison != 0)
+ return comparison;
+
if (static_cast<int>(server_status_) <
static_cast<int>(credit_card.server_status_))
return -1;

Powered by Google App Engine
This is Rietveld 408576698