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

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 typo, format errors. 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" consisnts of year-month.
dhollowa 2011/01/05 03:08:26 It is possible that that the |credit_card| has emp
dhollowa 2011/01/05 03:08:26 nit: s/consisnts/consists/
693 string16 month = credit_card->GetFieldText(
694 AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR));
695 month += ASCIIToUTF16("-");
696 month += credit_card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH));
697 field->set_value(month);
698 } else {
692 field->set_value(credit_card->GetFieldText(type)); 699 field->set_value(credit_card->GetFieldText(type));
700 }
693 } 701 }
694 702
695 void AutoFillManager::FillFormField(const AutoFillProfile* profile, 703 void AutoFillManager::FillFormField(const AutoFillProfile* profile,
696 AutoFillType type, 704 AutoFillType type,
697 webkit_glue::FormField* field) { 705 webkit_glue::FormField* field) {
698 DCHECK(profile); 706 DCHECK(profile);
699 DCHECK(type.group() != AutoFillType::CREDIT_CARD); 707 DCHECK(type.group() != AutoFillType::CREDIT_CARD);
700 DCHECK(field); 708 DCHECK(field);
701 709
702 if (type.subgroup() == AutoFillType::PHONE_NUMBER) { 710 if (type.subgroup() == AutoFillType::PHONE_NUMBER) {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 return std::string(); 818 return std::string();
811 819
812 std::map<int, std::string>::const_iterator iter = id_guid_map_.find(id); 820 std::map<int, std::string>::const_iterator iter = id_guid_map_.find(id);
813 if (iter == id_guid_map_.end()) { 821 if (iter == id_guid_map_.end()) {
814 NOTREACHED(); 822 NOTREACHED();
815 return std::string(); 823 return std::string();
816 } 824 }
817 825
818 return iter->second; 826 return iter->second;
819 } 827 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698