summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/credit_card_field.cc
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 17:14:34 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 17:14:34 +0000
commit3651cf802999c8ae4532a23db254e7249f45c589 (patch)
treef848ac03c01e9c393862021cad560bd77084b388 /chrome/browser/autofill/credit_card_field.cc
parentedbcde93e4b267c19e38fdc584509a044481f602 (diff)
downloadchromium_src-3651cf802999c8ae4532a23db254e7249f45c589.zip
chromium_src-3651cf802999c8ae4532a23db254e7249f45c589.tar.gz
chromium_src-3651cf802999c8ae4532a23db254e7249f45c589.tar.bz2
AutoFill: Credit card filling fixes.
* Widen the regexp for Expiration Month. * DCHECK that the number of fields matches between the FormStructure and the FormData results. * Remove the awful N^2 loop that was too paranoid now that we verify the field counts are the same. BUG=43365 TEST=CreditCardFieldTest.*,AutoFillManagerTest.* Review URL: http://codereview.chromium.org/2048003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46698 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/credit_card_field.cc')
-rw-r--r--chrome/browser/autofill/credit_card_field.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/chrome/browser/autofill/credit_card_field.cc b/chrome/browser/autofill/credit_card_field.cc
index 95f2f5b..0352a07 100644
--- a/chrome/browser/autofill/credit_card_field.cc
+++ b/chrome/browser/autofill/credit_card_field.cc
@@ -108,12 +108,11 @@ CreditCardField* CreditCardField::Parse(
if (is_ecml)
pattern = GetEcmlPattern(kEcmlCardNumber);
else
- pattern = ASCIIToUTF16("number|card #|card no.|card_number");
+ pattern = ASCIIToUTF16("number|card #|card no.|card_number|card number");
if (credit_card_field.number_ == NULL && ParseText(&q, pattern,
- &credit_card_field.number_)) {
+ &credit_card_field.number_))
continue;
- }
// "Expiration date" is the most common label here, but some pages have
// "Expires", "exp. date" or "exp. month" and "exp. year". We also look for
@@ -130,7 +129,7 @@ CreditCardField* CreditCardField::Parse(
if (is_ecml)
pattern = GetEcmlPattern(kEcmlCardExpireMonth);
else
- pattern = ASCIIToUTF16("expir|exp month|exp date|ccmonth|&month");
+ pattern = ASCIIToUTF16("expir|exp.*month|exp date|ccmonth");
if ((!credit_card_field.expiration_month_ ||
credit_card_field.expiration_month_->IsEmpty()) &&
@@ -140,9 +139,8 @@ CreditCardField* CreditCardField::Parse(
else
pattern = ASCIIToUTF16("|exp|^/|ccyear|year");
- if (!ParseText(&q, pattern, &credit_card_field.expiration_year_)) {
+ if (!ParseText(&q, pattern, &credit_card_field.expiration_year_))
return NULL;
- }
continue;
}