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
3 // found in the LICENSE file.
5 #include "components/autofill/core/browser/form_group.h"
7 #include "components/autofill/core/browser/autofill_type.h"
11 void FormGroup::GetMatchingTypes(const base::string16
& text
,
12 const std::string
& app_locale
,
13 ServerFieldTypeSet
* matching_types
) const {
15 matching_types
->insert(EMPTY_TYPE
);
19 ServerFieldTypeSet types
;
20 GetSupportedTypes(&types
);
21 for (ServerFieldTypeSet::const_iterator type
= types
.begin();
22 type
!= types
.end(); ++type
) {
23 if (GetInfo(AutofillType(*type
), app_locale
) == text
)
24 matching_types
->insert(*type
);
28 void FormGroup::GetNonEmptyTypes(const std::string
& app_locale
,
29 ServerFieldTypeSet
* non_empty_types
) const {
30 ServerFieldTypeSet types
;
31 GetSupportedTypes(&types
);
32 for (ServerFieldTypeSet::const_iterator type
= types
.begin();
33 type
!= types
.end(); ++type
) {
34 if (!GetInfo(AutofillType(*type
), app_locale
).empty())
35 non_empty_types
->insert(*type
);
39 base::string16
FormGroup::GetInfo(const AutofillType
& type
,
40 const std::string
& app_locale
) const {
41 return GetRawInfo(type
.GetStorableType());
44 bool FormGroup::SetInfo(const AutofillType
& type
,
45 const base::string16
& value
,
46 const std::string
& app_locale
) {
47 SetRawInfo(type
.GetStorableType(), value
);
51 } // namespace autofill