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

Side by Side Diff: components/autofill/core/browser/personal_data_manager.cc

Issue 2607043002: [Autofill] Credit Card Autofill Last Used Date Experiment (Closed)
Patch Set: Cleaned up included header 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/personal_data_manager.h" 5 #include "components/autofill/core/browser/personal_data_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 suggestion->backend_id = credit_card->guid(); 1612 suggestion->backend_id = credit_card->guid();
1613 suggestion->match = prefix_matched_suggestion 1613 suggestion->match = prefix_matched_suggestion
1614 ? Suggestion::PREFIX_MATCH 1614 ? Suggestion::PREFIX_MATCH
1615 : Suggestion::SUBSTRING_MATCH; 1615 : Suggestion::SUBSTRING_MATCH;
1616 1616
1617 // If the value is the card number, the label is the expiration date. 1617 // If the value is the card number, the label is the expiration date.
1618 // Otherwise the label is the card number, or if that is empty the 1618 // Otherwise the label is the card number, or if that is empty the
1619 // cardholder name. The label should never repeat the value. 1619 // cardholder name. The label should never repeat the value.
1620 if (type.GetStorableType() == CREDIT_CARD_NUMBER) { 1620 if (type.GetStorableType() == CREDIT_CARD_NUMBER) {
1621 suggestion->value = credit_card->TypeAndLastFourDigits(); 1621 suggestion->value = credit_card->TypeAndLastFourDigits();
1622 suggestion->label = credit_card->GetInfo( 1622 if (IsAutofillCreditCardLastUsedDateDisplayExperimentEnabled() &&
1623 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_); 1623 !IsKeyboardAccessoryEnabled() &&
1624 !IsAutofillCreditCardPopupLayoutExperimentEnabled()) {
1625 suggestion->label =
1626 credit_card->GetLastUsedDateForDisplay(app_locale_);
1627 } else {
1628 suggestion->label = credit_card->GetInfo(
1629 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_);
1630 }
1624 if (IsAutofillCreditCardPopupLayoutExperimentEnabled()) 1631 if (IsAutofillCreditCardPopupLayoutExperimentEnabled())
1625 ModifyAutofillCreditCardSuggestion(suggestion); 1632 ModifyAutofillCreditCardSuggestion(suggestion);
1626 } else if (credit_card->number().empty()) { 1633 } else if (credit_card->number().empty()) {
1627 if (type.GetStorableType() != CREDIT_CARD_NAME_FULL) { 1634 if (type.GetStorableType() != CREDIT_CARD_NAME_FULL) {
1628 suggestion->label = credit_card->GetInfo( 1635 suggestion->label = credit_card->GetInfo(
1629 AutofillType(CREDIT_CARD_NAME_FULL), app_locale_); 1636 AutofillType(CREDIT_CARD_NAME_FULL), app_locale_);
1630 } 1637 }
1631 } else { 1638 } else {
1632 #if defined(OS_ANDROID) 1639 #if defined(OS_ANDROID)
1633 // Since Android places the label on its own row, there's more 1640 // Since Android places the label on its own row, there's more
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 if (was_modified) { 1858 if (was_modified) {
1852 if (credit_card->record_type() == CreditCard::LOCAL_CARD) 1859 if (credit_card->record_type() == CreditCard::LOCAL_CARD)
1853 database_->UpdateCreditCard(*credit_card); 1860 database_->UpdateCreditCard(*credit_card);
1854 else 1861 else
1855 database_->UpdateServerCardMetadata(*credit_card); 1862 database_->UpdateServerCardMetadata(*credit_card);
1856 } 1863 }
1857 } 1864 }
1858 } 1865 }
1859 1866
1860 } // namespace autofill 1867 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698