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

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 typo, format errors. Created 9 years, 12 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 f8b4c5e210a81fae47c0ab965321bdccd0ff1c4b..338c486ab58dc2be452234c4896ed6c7d29d5336 100644
--- a/chrome/browser/autofill/credit_card_field.cc
+++ b/chrome/browser/autofill/credit_card_field.cc
@@ -135,14 +135,20 @@ CreditCardField* CreditCardField::Parse(
if ((!credit_card_field->expiration_month_ ||
dhollowa 2011/01/05 03:08:26 The handling of input type="month" should be split
honten.org 2011/01/05 08:09:09 Ok, So can I add new AutoFillType CREDIT_CARD_EXP
credit_card_field->expiration_month_->IsEmpty()) &&
ParseText(&q, pattern, &credit_card_field->expiration_month_)) {
- if (is_ecml)
- pattern = GetEcmlPattern(kEcmlCardExpireYear);
- else
- pattern = ASCIIToUTF16("|exp|^/|ccyear|year");
-
- if (!ParseText(&q, pattern, &credit_card_field->expiration_year_))
- return NULL;
+ // If type="month", year is included into the exipration_month_.
+ // So we don't need another year input field.
+ if (!LowerCaseEqualsASCII(
+ credit_card_field->expiration_month_->form_control_type(), "month")) {
+ if (is_ecml)
+ pattern = GetEcmlPattern(kEcmlCardExpireYear);
+ else
+ pattern = ASCIIToUTF16("|exp|^/|ccyear|year");
+
+ if (!ParseText(&q, pattern, &credit_card_field->expiration_year_)) {
+ return NULL;
+ }
+ }
continue;
}
@@ -177,7 +183,9 @@ 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")))) {
dhollowa 2011/01/05 03:08:26 nit: indentation seems off here. line 188 should
*iter = q;
return credit_card_field.release();
}

Powered by Google App Engine
This is Rietveld 408576698