| 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 09dab1e48d796800fda5065ee6cb54075fd5697a..8c2fc9e86a7b32f65da9bdfe1f91eeafc0f295df 100644
|
| --- a/components/autofill/core/browser/credit_card_field.cc
|
| +++ b/components/autofill/core/browser/credit_card_field.cc
|
| @@ -88,9 +88,33 @@ FormField* CreditCardField::Parse(AutofillScanner* scanner) {
|
| continue;
|
| }
|
|
|
| + pattern = base::UTF8ToUTF16(autofill::kCardNumberPart1Re);
|
| + if (!credit_card_field->number_part1_ &&
|
| + ParseField(scanner, pattern, &credit_card_field->number_part1_)) {
|
| + continue;
|
| + }
|
| +
|
| + pattern = base::UTF8ToUTF16(autofill::kCardNumberPart2Re);
|
| + if (!credit_card_field->number_part2_ &&
|
| + ParseField(scanner, pattern, &credit_card_field->number_part2_)) {
|
| + continue;
|
| + }
|
| +
|
| + pattern = base::UTF8ToUTF16(autofill::kCardNumberPart3Re);
|
| + if (!credit_card_field->number_part3_ &&
|
| + ParseField(scanner, pattern, &credit_card_field->number_part3_)) {
|
| + continue;
|
| + }
|
| +
|
| + pattern = base::UTF8ToUTF16(autofill::kCardNumberPart4Re);
|
| + if (!credit_card_field->number_part4_ &&
|
| + ParseField(scanner, pattern, &credit_card_field->number_part4_)) {
|
| + continue;
|
| + }
|
| +
|
| pattern = base::UTF8ToUTF16(autofill::kCardNumberRe);
|
| - if (!credit_card_field->number_ &&
|
| - ParseField(scanner, pattern, &credit_card_field->number_)) {
|
| + if (!credit_card_field->number_full_ &&
|
| + ParseField(scanner, pattern, &credit_card_field->number_full_)) {
|
| continue;
|
| }
|
|
|
| @@ -167,7 +191,7 @@ FormField* CreditCardField::Parse(AutofillScanner* scanner) {
|
| // a strong enough signal that this is a credit card. It is possible that
|
| // the number and name were parsed in a separate part of the form. So if
|
| // the cvc and date were found independently they are returned.
|
| - if ((credit_card_field->number_ || credit_card_field->verification_) &&
|
| + if ((credit_card_field->number_full_ || credit_card_field->verification_) &&
|
| (credit_card_field->expiration_date_ ||
|
| (credit_card_field->expiration_month_ &&
|
| credit_card_field->expiration_year_))) {
|
| @@ -182,7 +206,11 @@ CreditCardField::CreditCardField()
|
| : cardholder_(NULL),
|
| cardholder_last_(NULL),
|
| type_(NULL),
|
| - number_(NULL),
|
| + number_full_(NULL),
|
| + number_part1_(NULL),
|
| + number_part2_(NULL),
|
| + number_part3_(NULL),
|
| + number_part4_(NULL),
|
| verification_(NULL),
|
| expiration_month_(NULL),
|
| expiration_year_(NULL),
|
| @@ -191,7 +219,7 @@ CreditCardField::CreditCardField()
|
| }
|
|
|
| bool CreditCardField::ClassifyField(ServerFieldTypeMap* map) const {
|
| - bool ok = AddClassification(number_, CREDIT_CARD_NUMBER, map);
|
| + bool ok = AddClassification(number_full_, CREDIT_CARD_NUMBER, map);
|
| ok = ok && AddClassification(type_, CREDIT_CARD_TYPE, map);
|
| ok = ok && AddClassification(verification_, CREDIT_CARD_VERIFICATION_CODE,
|
| map);
|
| @@ -223,6 +251,12 @@ bool CreditCardField::ClassifyField(ServerFieldTypeMap* map) const {
|
| map);
|
| }
|
| }
|
| + if (number_full_ == NULL) {
|
| + ok = ok && AddClassification(number_part1_, CREDIT_CARD_NUMBER_PART1, map);
|
| + ok = ok && AddClassification(number_part2_, CREDIT_CARD_NUMBER_PART2, map);
|
| + ok = ok && AddClassification(number_part3_, CREDIT_CARD_NUMBER_PART3, map);
|
| + ok = ok && AddClassification(number_part4_, CREDIT_CARD_NUMBER_PART4, map);
|
| + }
|
|
|
| return ok;
|
| }
|
|
|