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

Unified Diff: chrome/browser/autofill/autofill_manager.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/autofill_manager.h ('k') | chrome/browser/autofill/autofill_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/autofill_manager.cc
diff --git a/chrome/browser/autofill/autofill_manager.cc b/chrome/browser/autofill/autofill_manager.cc
index 84af83644aa61264442ee720d166fd0b78b06dc7..adad24b5516b4fcaaa9efc1e613cf8fdab72c8ae 100644
--- a/chrome/browser/autofill/autofill_manager.cc
+++ b/chrome/browser/autofill/autofill_manager.cc
@@ -799,10 +799,22 @@ 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()) {
+ // Fill the value only if |credit_card| includes both year and month
+ // information.
+ field->set_value(year + ASCIIToUTF16("-") + month);
+ }
+ } else {
field->set_value(credit_card->GetFieldText(type));
+ }
}
void AutoFillManager::FillFormField(const AutoFillProfile* profile,
« no previous file with comments | « chrome/browser/autofill/autofill_manager.h ('k') | chrome/browser/autofill/autofill_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698