OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "components/autofill/browser/form_group.h" | |
6 | |
7 namespace autofill { | |
8 | |
9 void FormGroup::GetMatchingTypes(const base::string16& text, | |
10 const std::string& app_locale, | |
11 FieldTypeSet* matching_types) const { | |
12 if (text.empty()) { | |
13 matching_types->insert(EMPTY_TYPE); | |
14 return; | |
15 } | |
16 | |
17 FieldTypeSet types; | |
18 GetSupportedTypes(&types); | |
19 for (FieldTypeSet::const_iterator type = types.begin(); | |
20 type != types.end(); ++type) { | |
21 // TODO(isherman): Matches are case-sensitive for now. Let's keep an eye on | |
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); | |
26 } | |
27 } | |
28 | |
29 void FormGroup::GetNonEmptyTypes(const std::string& app_locale, | |
30 FieldTypeSet* non_empty_types) const { | |
31 FieldTypeSet types; | |
32 GetSupportedTypes(&types); | |
33 for (FieldTypeSet::const_iterator type = types.begin(); | |
34 type != types.end(); ++type) { | |
35 if (!GetInfo(*type, app_locale).empty()) | |
36 non_empty_types->insert(*type); | |
37 } | |
38 } | |
39 | |
40 base::string16 FormGroup::GetInfo(AutofillFieldType type, | |
41 const std::string& app_locale) const { | |
42 return GetRawInfo(type); | |
43 } | |
44 | |
45 bool FormGroup::SetInfo(AutofillFieldType type, | |
46 const base::string16& value, | |
47 const std::string& app_locale) { | |
48 SetRawInfo(type, value); | |
49 return true; | |
50 } | |
51 | |
52 } // namespace autofill | |
OLD | NEW |