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 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_ | |
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_ | |
7 | |
8 #include <map> | |
9 #include <set> | |
10 #include <string> | |
11 | |
12 #include "base/string16.h" | |
13 #include "chrome/browser/autofill/field_types.h" | |
14 | |
15 // The high-level description of Autofill types, used to categorize form fields | |
16 // and for associating form fields with form values in the Web Database. | |
17 class AutofillType { | |
18 public: | |
19 enum FieldTypeGroup { | |
20 NO_GROUP, | |
21 NAME, | |
22 EMAIL, | |
23 COMPANY, | |
24 ADDRESS_HOME, | |
25 ADDRESS_BILLING, | |
26 PHONE, | |
27 CREDIT_CARD, | |
28 }; | |
29 | |
30 explicit AutofillType(AutofillFieldType field_type); | |
31 AutofillType(const AutofillType& autofill_type); | |
32 AutofillType& operator=(const AutofillType& autofill_type); | |
33 | |
34 AutofillFieldType field_type() const; | |
35 FieldTypeGroup group() const; | |
36 | |
37 // Maps |field_type| to a field type that can be directly stored in a profile | |
38 // (in the sense that it makes sense to call |AutofillProfile::SetInfo()| with | |
39 // the returned field type as the first parameter). | |
40 static AutofillFieldType GetEquivalentFieldType(AutofillFieldType field_type); | |
41 | |
42 // Utilities for serializing and deserializing an |AutofillFieldType|. | |
43 static std::string FieldTypeToString(AutofillFieldType field_type); | |
44 static AutofillFieldType StringToFieldType(const std::string& str); | |
45 | |
46 private: | |
47 AutofillFieldType field_type_; | |
48 }; | |
49 | |
50 typedef AutofillType::FieldTypeGroup FieldTypeGroup; | |
51 typedef std::set<AutofillFieldType> FieldTypeSet; | |
52 typedef std::map<string16, AutofillFieldType> FieldTypeMap; | |
53 | |
54 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_ | |
OLD | NEW |