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

Side by Side Diff: components/autofill/core/browser/form_group.cc

Issue 22009003: [Autofill] Distinguish between native field types and potentially HTML field types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/autofill/core/browser/form_group.h" 5 #include "components/autofill/core/browser/form_group.h"
6 6
7 #include "components/autofill/core/browser/autofill_type.h"
8
7 namespace autofill { 9 namespace autofill {
8 10
9 void FormGroup::GetMatchingTypes(const base::string16& text, 11 void FormGroup::GetMatchingTypes(const base::string16& text,
10 const std::string& app_locale, 12 const std::string& app_locale,
11 FieldTypeSet* matching_types) const { 13 ServerFieldTypeSet* matching_types) const {
12 if (text.empty()) { 14 if (text.empty()) {
13 matching_types->insert(EMPTY_TYPE); 15 matching_types->insert(EMPTY_TYPE);
14 return; 16 return;
15 } 17 }
16 18
17 FieldTypeSet types; 19 ServerFieldTypeSet types;
18 GetSupportedTypes(&types); 20 GetSupportedTypes(&types);
19 for (FieldTypeSet::const_iterator type = types.begin(); 21 for (ServerFieldTypeSet::const_iterator type = types.begin();
20 type != types.end(); ++type) { 22 type != types.end(); ++type) {
21 // TODO(isherman): Matches are case-sensitive for now. Let's keep an eye on 23 if (GetInfo(AutofillType(*type), app_locale) == text)
22 // this and decide whether there are compelling reasons to add case-
23 // insensitivity.
24 if (GetInfo(*type, app_locale) == text)
25 matching_types->insert(*type); 24 matching_types->insert(*type);
26 } 25 }
27 } 26 }
28 27
29 void FormGroup::GetNonEmptyTypes(const std::string& app_locale, 28 void FormGroup::GetNonEmptyTypes(const std::string& app_locale,
30 FieldTypeSet* non_empty_types) const { 29 ServerFieldTypeSet* non_empty_types) const {
31 FieldTypeSet types; 30 ServerFieldTypeSet types;
32 GetSupportedTypes(&types); 31 GetSupportedTypes(&types);
33 for (FieldTypeSet::const_iterator type = types.begin(); 32 for (ServerFieldTypeSet::const_iterator type = types.begin();
34 type != types.end(); ++type) { 33 type != types.end(); ++type) {
35 if (!GetInfo(*type, app_locale).empty()) 34 if (!GetInfo(AutofillType(*type), app_locale).empty())
36 non_empty_types->insert(*type); 35 non_empty_types->insert(*type);
37 } 36 }
38 } 37 }
39 38
40 base::string16 FormGroup::GetInfo(AutofillFieldType type, 39 base::string16 FormGroup::GetInfo(const AutofillType& type,
41 const std::string& app_locale) const { 40 const std::string& app_locale) const {
42 return GetRawInfo(type); 41 return GetRawInfo(type.server_type());
43 } 42 }
44 43
45 bool FormGroup::SetInfo(AutofillFieldType type, 44 bool FormGroup::SetInfo(const AutofillType& type,
46 const base::string16& value, 45 const base::string16& value,
47 const std::string& app_locale) { 46 const std::string& app_locale) {
48 SetRawInfo(type, value); 47 SetRawInfo(type.server_type(), value);
49 return true; 48 return true;
50 } 49 }
51 50
52 } // namespace autofill 51 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/form_group.h ('k') | components/autofill/core/browser/form_structure.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698