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

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 merge error. Created 9 years, 10 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 <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 } 792 }
793 } 793 }
794 794
795 void AutoFillManager::FillCreditCardFormField(const CreditCard* credit_card, 795 void AutoFillManager::FillCreditCardFormField(const CreditCard* credit_card,
796 AutoFillType type, 796 AutoFillType type,
797 webkit_glue::FormField* field) { 797 webkit_glue::FormField* field) {
798 DCHECK(credit_card); 798 DCHECK(credit_card);
799 DCHECK(type.group() == AutoFillType::CREDIT_CARD); 799 DCHECK(type.group() == AutoFillType::CREDIT_CARD);
800 DCHECK(field); 800 DCHECK(field);
801 801
802 if (field->form_control_type() == ASCIIToUTF16("select-one")) 802 if (field->form_control_type() == ASCIIToUTF16("select-one")) {
803 autofill::FillSelectControl(credit_card, type, field); 803 autofill::FillSelectControl(credit_card, type, field);
804 else 804 } else if (field->form_control_type() == ASCIIToUTF16("month")) {
805 // HTML5 input="month" consists of year-month.
806 string16 year = credit_card->GetFieldText(
807 AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR));
808 string16 month = credit_card->GetFieldText(
809 AutoFillType(CREDIT_CARD_EXP_MONTH));
810 if (!year.empty() && !month.empty()) {
811 // Fill the value only if |credit_card| includes both year and month
812 // information.
813 field->set_value(year + ASCIIToUTF16("-") + month);
814 }
815 } else {
805 field->set_value(credit_card->GetFieldText(type)); 816 field->set_value(credit_card->GetFieldText(type));
817 }
806 } 818 }
807 819
808 void AutoFillManager::FillFormField(const AutoFillProfile* profile, 820 void AutoFillManager::FillFormField(const AutoFillProfile* profile,
809 AutoFillType type, 821 AutoFillType type,
810 webkit_glue::FormField* field) { 822 webkit_glue::FormField* field) {
811 DCHECK(profile); 823 DCHECK(profile);
812 DCHECK(type.group() != AutoFillType::CREDIT_CARD); 824 DCHECK(type.group() != AutoFillType::CREDIT_CARD);
813 DCHECK(field); 825 DCHECK(field);
814 826
815 if (type.subgroup() == AutoFillType::PHONE_NUMBER) { 827 if (type.subgroup() == AutoFillType::PHONE_NUMBER) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 return std::string(); 933 return std::string();
922 934
923 std::map<int, std::string>::const_iterator iter = id_guid_map_.find(id); 935 std::map<int, std::string>::const_iterator iter = id_guid_map_.find(id);
924 if (iter == id_guid_map_.end()) { 936 if (iter == id_guid_map_.end()) {
925 NOTREACHED(); 937 NOTREACHED();
926 return std::string(); 938 return std::string();
927 } 939 }
928 940
929 return iter->second; 941 return iter->second;
930 } 942 }
OLDNEW
« 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