Chromium Code Reviews| Index: chrome/browser/autofill/autofill_manager.cc |
| diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc |
| index 162375268776d8418d802d495793a96847dc7b5f..6794cda2eda0a04246544a8b0fa02a00abb7ce28 100644 |
| --- a/chrome/browser/autofill/autofill_manager.cc |
| +++ b/chrome/browser/autofill/autofill_manager.cc |
| @@ -686,10 +686,23 @@ void AutoFillManager::FillCreditCardFormField(const CreditCard* credit_card, |
| DCHECK(type.group() == AutoFillType::CREDIT_CARD); |
| DCHECK(field); |
| - if (field->form_control_type() == ASCIIToUTF16("select-one")) |
| + if (field->form_control_type() == ASCIIToUTF16("select-one")) { |
| autofill::FillSelectControl(credit_card, type, field); |
| - else |
| + } else if (field->form_control_type() == ASCIIToUTF16("month")) { |
| + // HTML5 input="month" consists of year-month. |
| + string16 year = credit_card->GetFieldText( |
| + AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)); |
| + string16 month = credit_card->GetFieldText( |
| + AutoFillType(CREDIT_CARD_EXP_MONTH)); |
| + if (!year.empty() && !month.empty()) { |
| + // Iff |credit_card| has both year and month, fill the value. |
| + // Because |credit_card| might not have both info. |
|
Ilya Sherman
2011/01/07 07:28:28
nit: This comment might be clearer as "Fill the va
|
| + month = year + ASCIIToUTF16("-") + month; |
| + field->set_value(month); |
| + } |
| + } else { |
| field->set_value(credit_card->GetFieldText(type)); |
|
honten.org
2011/01/06 07:04:54
As you pointed out, only both are not empty, set t
|
| + } |
| } |
| void AutoFillManager::FillFormField(const AutoFillProfile* profile, |