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

Unified Diff: chrome/browser/autofill/credit_card_field.cc

Issue 6033010: Support autocompletion for HTMl5 tags:"email", "month" and "tel". (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: unroll tests. Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autofill/credit_card_field.cc
diff --git a/chrome/browser/autofill/credit_card_field.cc b/chrome/browser/autofill/credit_card_field.cc
index 3a51b6ffc69368ba8dffefe7aa357ea75ba922ce..d55f51059056f6ee881aab495ee69e654e13d64f 100644
--- a/chrome/browser/autofill/credit_card_field.cc
+++ b/chrome/browser/autofill/credit_card_field.cc
@@ -118,35 +118,40 @@ CreditCardField* CreditCardField::Parse(
&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
- // the field names ccmonth and ccyear, which appear on at least 4 of our
- // test pages.
- //
- // -> On at least one page (The China Shop2.html) we find only the labels
- // "month" and "year". So for now we match these words directly; we'll
- // see if this turns out to be too general.
- //
- // Toolbar Bug 51451: indeed, simply matching "month" is too general for
- // https://rps.fidelity.com/ftgw/rps/RtlCust/CreatePIN/Init.
- // Instead, we match only words beginning with "month".
- if (is_ecml)
- pattern = GetEcmlPattern(kEcmlCardExpireMonth);
- else
- pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_EXPIRATION_MONTH_RE);
-
- if ((!credit_card_field->expiration_month_ ||
- credit_card_field->expiration_month_->IsEmpty()) &&
- ParseText(&q, pattern, &credit_card_field->expiration_month_)) {
+ if ((*q) && LowerCaseEqualsASCII((*q)->form_control_type(), "month")) {
+ credit_card_field->expiration_month_ = *q++;
honten.org 2011/01/07 05:33:49 I cannot reproduce your bug. I made form as follo
dhollowa 2011/01/07 19:29:46 I tried again with this latest patch and things se
+ } else {
+ // "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 the field names ccmonth and ccyear, which appear on at least 4 of
+ // our test pages.
+ //
+ // -> On at least one page (The China Shop2.html) we find only the labels
+ // "month" and "year". So for now we match these words directly; we'll
+ // see if this turns out to be too general.
+ //
+ // Toolbar Bug 51451: indeed, simply matching "month" is too general for
+ // https://rps.fidelity.com/ftgw/rps/RtlCust/CreatePIN/Init.
+ // Instead, we match only words beginning with "month".
if (is_ecml)
- pattern = GetEcmlPattern(kEcmlCardExpireYear);
+ pattern = GetEcmlPattern(kEcmlCardExpireMonth);
else
- pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_EXPIRATION_DATE_RE);
+ pattern = ASCIIToUTF16("expir|exp.*month|exp date|ccmonth");
dhollowa 2011/01/07 18:50:26 These regexes should be pulled from resources. It
- if (!ParseText(&q, pattern, &credit_card_field->expiration_year_))
- return NULL;
+ if ((!credit_card_field->expiration_month_ ||
+ credit_card_field->expiration_month_->IsEmpty()) &&
+ ParseText(&q, pattern, &credit_card_field->expiration_month_)) {
- continue;
+ if (is_ecml)
+ pattern = GetEcmlPattern(kEcmlCardExpireYear);
+ else
+ pattern = ASCIIToUTF16("|exp|^/|ccyear|year");
+
+ if (!ParseText(&q, pattern, &credit_card_field->expiration_year_)) {
+ return NULL;
+ }
+ continue;
+ }
}
if (ParseText(&q, GetEcmlPattern(kEcmlCardExpireDay)))
@@ -180,7 +185,10 @@ CreditCardField* CreditCardField::Parse(
// the cvc and date were found independently they are returned.
if ((credit_card_field->number_ || credit_card_field->verification_) &&
credit_card_field->expiration_month_ &&
- credit_card_field->expiration_year_) {
+ (credit_card_field->expiration_year_ ||
+ (LowerCaseEqualsASCII(
+ credit_card_field->expiration_month_->form_control_type(),
+ "month")))) {
*iter = q;
return credit_card_field.release();
}

Powered by Google App Engine
This is Rietveld 408576698