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(); |
} |