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

Side by Side 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 format errors and other naming issues. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/autofill/autofill_manager.h" 5 #include "chrome/browser/autofill/autofill_manager.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 679 }
680 } 680 }
681 681
682 void AutoFillManager::FillCreditCardFormField(const CreditCard* credit_card, 682 void AutoFillManager::FillCreditCardFormField(const CreditCard* credit_card,
683 AutoFillType type, 683 AutoFillType type,
684 webkit_glue::FormField* field) { 684 webkit_glue::FormField* field) {
685 DCHECK(credit_card); 685 DCHECK(credit_card);
686 DCHECK(type.group() == AutoFillType::CREDIT_CARD); 686 DCHECK(type.group() == AutoFillType::CREDIT_CARD);
687 DCHECK(field); 687 DCHECK(field);
688 688
689 if (field->form_control_type() == ASCIIToUTF16("select-one")) 689 if (field->form_control_type() == ASCIIToUTF16("select-one")) {
690 autofill::FillSelectControl(credit_card, type, field); 690 autofill::FillSelectControl(credit_card, type, field);
691 else 691 } else if (field->form_control_type() == ASCIIToUTF16("month")) {
692 // HTML5 input="month" consists of year-month.
693 string16 year = credit_card->GetFieldText(
694 AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR));
695 string16 month = credit_card->GetFieldText(
696 AutoFillType(CREDIT_CARD_EXP_MONTH));
697 if (!year.empty() && !month.empty()) {
698 // Fill the value only if |credit_card| includes both year and month
699 // information.
700 month = year + ASCIIToUTF16("-") + month;
Ilya Sherman 2011/01/10 20:08:48 nit: Naming this "month" is confusing. Please eit
honten.org 2011/01/25 05:19:24 Done.
701 field->set_value(month);
702 }
703 } else {
692 field->set_value(credit_card->GetFieldText(type)); 704 field->set_value(credit_card->GetFieldText(type));
705 }
693 } 706 }
694 707
695 void AutoFillManager::FillFormField(const AutoFillProfile* profile, 708 void AutoFillManager::FillFormField(const AutoFillProfile* profile,
696 AutoFillType type, 709 AutoFillType type,
697 webkit_glue::FormField* field) { 710 webkit_glue::FormField* field) {
698 DCHECK(profile); 711 DCHECK(profile);
699 DCHECK(type.group() != AutoFillType::CREDIT_CARD); 712 DCHECK(type.group() != AutoFillType::CREDIT_CARD);
700 DCHECK(field); 713 DCHECK(field);
701 714
702 if (type.subgroup() == AutoFillType::PHONE_NUMBER) { 715 if (type.subgroup() == AutoFillType::PHONE_NUMBER) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 return std::string(); 823 return std::string();
811 824
812 std::map<int, std::string>::const_iterator iter = id_guid_map_.find(id); 825 std::map<int, std::string>::const_iterator iter = id_guid_map_.find(id);
813 if (iter == id_guid_map_.end()) { 826 if (iter == id_guid_map_.end()) {
814 NOTREACHED(); 827 NOTREACHED();
815 return std::string(); 828 return std::string();
816 } 829 }
817 830
818 return iter->second; 831 return iter->second;
819 } 832 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698