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

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

Issue 2607043002: [Autofill] Credit Card Autofill Last Used Date Experiment (Closed)
Patch Set: Add date formatter based on pattern Created 3 years, 11 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/personal_data_manager.cc
diff --git a/components/autofill/core/browser/personal_data_manager.cc b/components/autofill/core/browser/personal_data_manager.cc
index d2a931c0d2b3453dd07752fa471eedb3d55e245c..735ae249d039543b18a056c174eb516a0b1669b1 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -1633,8 +1633,25 @@ std::vector<Suggestion> PersonalDataManager::GetSuggestionsForCards(
// cardholder name. The label should never repeat the value.
if (type.GetStorableType() == CREDIT_CARD_NUMBER) {
suggestion->value = credit_card->TypeAndLastFourDigits();
- suggestion->label = credit_card->GetInfo(
- AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_);
+ if (IsAutofillCreditCardLastUsedDateDisplayExperimentEnabled() &&
+ !IsKeyboardAccessoryEnabled()) {
+ if (ShowExpirationDateInAutofillCreditCardLastUsedDate()) {
+ suggestion->label = credit_card->GetInfo(
+ AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_);
+ }
+ if (suggestion->label.empty()) {
+ suggestion->label = credit_card->GetLastUsedDateForDisplay(
+ ShowExpirationDateInAutofillCreditCardLastUsedDate(),
+ ShowTimeDetailInAutofillCreditCardLastUsedDate());
+ } else {
+ suggestion->label.append(credit_card->GetLastUsedDateForDisplay(
+ ShowExpirationDateInAutofillCreditCardLastUsedDate(),
+ ShowTimeDetailInAutofillCreditCardLastUsedDate()));
jungshik at Google 2017/01/23 21:43:24 This kind of concatenating strings (Exp. date + La
jiahuiguo 2017/01/26 05:46:13 Done.
+ }
+ } else {
+ suggestion->label = credit_card->GetInfo(
+ AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_);
+ }
if (IsAutofillCreditCardPopupLayoutExperimentEnabled())
ModifyAutofillCreditCardSuggestion(suggestion);
} else if (credit_card->number().empty()) {

Powered by Google App Engine
This is Rietveld 408576698