| Index: components/autofill/core/browser/credit_card_field.cc
|
| diff --git a/components/autofill/core/browser/credit_card_field.cc b/components/autofill/core/browser/credit_card_field.cc
|
| index 3ac65c0cfe0fd5cf2eddb630e8ab508dcf32aa88..ea870df43a1d573da4d531d10bf4cfd2714970f9 100644
|
| --- a/components/autofill/core/browser/credit_card_field.cc
|
| +++ b/components/autofill/core/browser/credit_card_field.cc
|
| @@ -111,6 +111,16 @@ scoped_ptr<FormField> CreditCardField::Parse(AutofillScanner* scanner) {
|
| &credit_card_field->cardholder_)) {
|
| continue;
|
| }
|
| + } else if (!credit_card_field->cardholder_last_) {
|
| + // Search for "last.*name" or "name.*last". Since these are dangerously
|
| + // generic searches, we search for these only after we have found a valid
|
| + // first name and haven't yet parsed the expiration date (which
|
| + // usually appears at the end).
|
| + if (!credit_card_field->expiration_month_ &&
|
| + ParseField(scanner, base::UTF8ToUTF16(kLastNameOnCardContextualRe),
|
| + &credit_card_field->cardholder_last_)) {
|
| + continue;
|
| + }
|
| }
|
|
|
| // Check for a credit card type (Visa, MasterCard, etc.) field.
|
| @@ -326,8 +336,12 @@ bool CreditCardField::ClassifyField(ServerFieldTypeMap* map) const {
|
| // then ignore both fields. Putting them into separate fields is probably
|
| // wrong, because the credit card can also contain a middle name or middle
|
| // initial.
|
| - if (cardholder_last_ == nullptr)
|
| + if (cardholder_last_ == nullptr) {
|
| ok = ok && AddClassification(cardholder_, CREDIT_CARD_NAME, map);
|
| + } else {
|
| + ok = ok && AddClassification(cardholder_, CREDIT_CARD_NAME_FIRST, map);
|
| + ok = ok && AddClassification(cardholder_last_, CREDIT_CARD_NAME_LAST, map);
|
| + }
|
|
|
| if (expiration_date_) {
|
| DCHECK(!expiration_month_);
|
|
|