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

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

Issue 2711543002: Experiment to add bank name in autofill ui. (Closed)
Patch Set: Experiment to add bank name in autofill ui. Created 3 years, 6 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 33dc123d3b6a535525539d50f423f11d84295ca4..ee83a82a6f2c851457871e6c61010ef6530f3458 100644
--- a/components/autofill/core/browser/credit_card.cc
+++ b/components/autofill/core/browser/credit_card.cc
@@ -498,6 +498,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());
@@ -564,6 +565,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;
@@ -739,6 +744,7 @@ base::string16 CreditCard::NetworkForDisplay() const {
base::string16 CreditCard::NetworkAndLastFourDigits() const {
base::string16 network = NetworkForDisplay();
+ // TODO(crbug.com/734197): truncate network.
base::string16 digits = LastFourDigits();
if (digits.empty())
@@ -748,6 +754,14 @@ base::string16 CreditCard::NetworkAndLastFourDigits() const {
return network + base::string16(kMidlineEllipsis) + digits;
}
+base::string16 CreditCard::BankNameAndLastFourDigits() const {
+ base::string16 digits = LastFourDigits();
+ // TODO(crbug.com/734197): truncate bank name.
+ if (digits.empty())
+ return ASCIIToUTF16(bank_name_);
+ return ASCIIToUTF16(bank_name_) + base::string16(kMidlineEllipsis) + digits;
+}
+
base::string16 CreditCard::AbbreviatedExpirationDateForDisplay() const {
base::string16 month = ExpirationMonthAsString();
base::string16 year = Expiration2DigitYearAsString();
« no previous file with comments | « components/autofill/core/browser/credit_card.h ('k') | components/autofill/core/browser/credit_card_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698