OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "chrome/browser/autofill/form_group.h" | 7 #include "chrome/browser/autofill/form_group.h" |
8 | 8 |
9 #include <iterator> | 9 #include <iterator> |
10 | 10 |
11 void FormGroup::GetMatchingTypes(const string16& text, | 11 void FormGroup::GetMatchingTypes(const string16& text, |
12 FieldTypeSet* matching_types) const { | 12 FieldTypeSet* matching_types) const { |
13 if (text.empty()) { | 13 if (text.empty()) { |
14 matching_types->insert(EMPTY_TYPE); | 14 matching_types->insert(EMPTY_TYPE); |
15 return; | 15 return; |
16 } | 16 } |
17 | 17 |
18 FieldTypeSet types; | 18 FieldTypeSet types; |
19 GetSupportedTypes(&types); | 19 GetSupportedTypes(&types); |
20 for (FieldTypeSet::const_iterator type = types.begin(); | 20 for (FieldTypeSet::const_iterator type = types.begin(); |
21 type != types.end(); ++type) { | 21 type != types.end(); ++type) { |
22 // TODO(isherman): Matches are case-sensitive for now. Let's keep an eye on | 22 // TODO(isherman): Matches are case-sensitive for now. Let's keep an eye on |
23 // this and decide whether there are compelling reasons to add case- | 23 // this and decide whether there are compelling reasons to add case- |
24 // insensitivity. | 24 // insensitivity. |
25 if (GetInfo(*type) == text) | 25 if (GetRawInfo(*type) == text) |
26 matching_types->insert(*type); | 26 matching_types->insert(*type); |
27 } | 27 } |
28 } | 28 } |
29 | 29 |
30 void FormGroup::GetNonEmptyTypes(FieldTypeSet* non_empty_types) const { | 30 void FormGroup::GetNonEmptyTypes(FieldTypeSet* non_empty_types) const { |
31 FieldTypeSet types; | 31 FieldTypeSet types; |
32 GetSupportedTypes(&types); | 32 GetSupportedTypes(&types); |
33 for (FieldTypeSet::const_iterator type = types.begin(); | 33 for (FieldTypeSet::const_iterator type = types.begin(); |
34 type != types.end(); ++type) { | 34 type != types.end(); ++type) { |
35 if (!GetInfo(*type).empty()) | 35 if (!GetRawInfo(*type).empty()) |
36 non_empty_types->insert(*type); | 36 non_empty_types->insert(*type); |
37 } | 37 } |
38 } | 38 } |
39 | 39 |
40 string16 FormGroup::GetCanonicalizedInfo(AutofillFieldType type) const { | 40 string16 FormGroup::GetCanonicalizedInfo(AutofillFieldType type) const { |
41 return GetInfo(type); | 41 return GetRawInfo(type); |
42 } | 42 } |
43 | 43 |
44 bool FormGroup::SetCanonicalizedInfo(AutofillFieldType type, | 44 bool FormGroup::SetCanonicalizedInfo(AutofillFieldType type, |
45 const string16& value) { | 45 const string16& value) { |
46 SetInfo(type, value); | 46 SetRawInfo(type, value); |
47 return true; | 47 return true; |
48 } | 48 } |
OLD | NEW |