| OLD | NEW |
| 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 Loading... |
| 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 suggestion->label = |
| 1625 credit_card->GetLastUsedDateForDisplay(app_locale_); |
| 1626 } else { |
| 1627 suggestion->label = credit_card->GetInfo( |
| 1628 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_); |
| 1629 } |
| 1624 if (IsAutofillCreditCardPopupLayoutExperimentEnabled()) | 1630 if (IsAutofillCreditCardPopupLayoutExperimentEnabled()) |
| 1625 ModifyAutofillCreditCardSuggestion(suggestion); | 1631 ModifyAutofillCreditCardSuggestion(suggestion); |
| 1626 } else if (credit_card->number().empty()) { | 1632 } else if (credit_card->number().empty()) { |
| 1627 if (type.GetStorableType() != CREDIT_CARD_NAME_FULL) { | 1633 if (type.GetStorableType() != CREDIT_CARD_NAME_FULL) { |
| 1628 suggestion->label = credit_card->GetInfo( | 1634 suggestion->label = credit_card->GetInfo( |
| 1629 AutofillType(CREDIT_CARD_NAME_FULL), app_locale_); | 1635 AutofillType(CREDIT_CARD_NAME_FULL), app_locale_); |
| 1630 } | 1636 } |
| 1631 } else { | 1637 } else { |
| 1632 #if defined(OS_ANDROID) | 1638 #if defined(OS_ANDROID) |
| 1633 // Since Android places the label on its own row, there's more | 1639 // Since Android places the label on its own row, there's more |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1851 if (was_modified) { | 1857 if (was_modified) { |
| 1852 if (credit_card->record_type() == CreditCard::LOCAL_CARD) | 1858 if (credit_card->record_type() == CreditCard::LOCAL_CARD) |
| 1853 database_->UpdateCreditCard(*credit_card); | 1859 database_->UpdateCreditCard(*credit_card); |
| 1854 else | 1860 else |
| 1855 database_->UpdateServerCardMetadata(*credit_card); | 1861 database_->UpdateServerCardMetadata(*credit_card); |
| 1856 } | 1862 } |
| 1857 } | 1863 } |
| 1858 } | 1864 } |
| 1859 | 1865 |
| 1860 } // namespace autofill | 1866 } // namespace autofill |
| OLD | NEW |