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

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

Issue 2607043002: [Autofill] Credit Card Autofill Last Used Date Experiment (Closed)
Patch Set: Added variations to show expiration date and detail time info 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 61182febbd91e7487a8f8e661b2a8ed953d80866..b34eefa817b00a7b1189d46a58d0aa51bb660b44 100644
--- a/components/autofill/core/browser/personal_data_manager.cc
+++ b/components/autofill/core/browser/personal_data_manager.cc
@@ -1633,8 +1633,27 @@ 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->LastUsedDateAsString(
+ ShowDetailedTimeInfoInAutofillCreditCardLastUsedDate(),
+ ShowExpirationDateInAutofillCreditCardLastUsedDate(),
+ app_locale_);
+ } else {
+ suggestion->label.append(credit_card->LastUsedDateAsString(
+ ShowDetailedTimeInfoInAutofillCreditCardLastUsedDate(),
+ ShowExpirationDateInAutofillCreditCardLastUsedDate(),
+ app_locale_));
+ }
+ } 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