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

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

Issue 1694443004: [Autofill] Add credit card first and last name heuristics predictions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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 #include <algorithm> 8 #include <algorithm>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 suggestion->backend_id = credit_card->guid(); 813 suggestion->backend_id = credit_card->guid();
814 814
815 // If the value is the card number, the label is the expiration date. 815 // If the value is the card number, the label is the expiration date.
816 // Otherwise the label is the card number, or if that is empty the 816 // Otherwise the label is the card number, or if that is empty the
817 // cardholder name. The label should never repeat the value. 817 // cardholder name. The label should never repeat the value.
818 if (type.GetStorableType() == CREDIT_CARD_NUMBER) { 818 if (type.GetStorableType() == CREDIT_CARD_NUMBER) {
819 suggestion->value = credit_card->TypeAndLastFourDigits(); 819 suggestion->value = credit_card->TypeAndLastFourDigits();
820 suggestion->label = credit_card->GetInfo( 820 suggestion->label = credit_card->GetInfo(
821 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_); 821 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_);
822 } else if (credit_card->number().empty()) { 822 } else if (credit_card->number().empty()) {
823 if (type.GetStorableType() != CREDIT_CARD_NAME) { 823 if (type.GetStorableType() != CREDIT_CARD_NAME_FULL) {
824 suggestion->label = 824 suggestion->label = credit_card->GetInfo(
825 credit_card->GetInfo(AutofillType(CREDIT_CARD_NAME), app_locale_); 825 AutofillType(CREDIT_CARD_NAME_FULL), app_locale_);
826 } 826 }
827 } else { 827 } else {
828 #if defined(OS_ANDROID) 828 #if defined(OS_ANDROID)
829 // Since Android places the label on its own row, there's more horizontal 829 // Since Android places the label on its own row, there's more horizontal
830 // space to work with. Show "Amex - 1234" rather than desktop's "*1234". 830 // space to work with. Show "Amex - 1234" rather than desktop's "*1234".
831 suggestion->label = credit_card->TypeAndLastFourDigits(); 831 suggestion->label = credit_card->TypeAndLastFourDigits();
832 #else 832 #else
833 suggestion->label = base::ASCIIToUTF16("*"); 833 suggestion->label = base::ASCIIToUTF16("*");
834 suggestion->label.append(credit_card->LastFourDigits()); 834 suggestion->label.append(credit_card->LastFourDigits());
835 #endif 835 #endif
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 web_profiles().end()); 1411 web_profiles().end());
1412 if (IsExperimentalWalletIntegrationEnabled() && 1412 if (IsExperimentalWalletIntegrationEnabled() &&
1413 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { 1413 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) {
1414 profiles_.insert( 1414 profiles_.insert(
1415 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); 1415 profiles_.end(), server_profiles_.begin(), server_profiles_.end());
1416 } 1416 }
1417 return profiles_; 1417 return profiles_;
1418 } 1418 }
1419 1419
1420 } // namespace autofill 1420 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698