Chromium Code Reviews| 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..e53a6f99e8c2f542733961db2333039638cf2175 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 |
|
Mathieu
2016/02/24 21:58:26
we are now using the fuller kLastNameRe so your co
sebsg
2016/03/01 16:32:53
Done.
|
| + // 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(kLastNameRe), |
| + &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) |
| - ok = ok && AddClassification(cardholder_, CREDIT_CARD_NAME, map); |
| + if (cardholder_last_ == nullptr) { |
| + ok = ok && AddClassification(cardholder_, CREDIT_CARD_NAME_FULL, 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_); |