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

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: Fix merge error. 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
« no previous file with comments | « chrome/browser/autofill/credit_card.cc ('k') | chrome/browser/autofill/personal_data_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7837463c3d4f12e50916e405a5c58225da66f6c1..746bdf993e408eb3929d3089e7af2bafc917e40c 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++;
+ } 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 = l10n_util::GetStringUTF16(IDS_AUTOFILL_EXPIRATION_MONTH_RE);
- 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 = l10n_util::GetStringUTF16(IDS_AUTOFILL_EXPIRATION_DATE_RE);
+
+ 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();
}
« no previous file with comments | « chrome/browser/autofill/credit_card.cc ('k') | chrome/browser/autofill/personal_data_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698