field_types.h revision 3240926e260ce088908e02ac07a6cf7b0c0cbf44
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.
4
5#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_TYPES_H_
6#define COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_TYPES_H_
7
8#include <map>
9#include <set>
10
11#include "base/strings/string16.h"
12
13namespace autofill {
14
15// NOTE: This list MUST not be modified.  The server aggregates and stores these
16// types over several versions, so we must remain fully compatible with the
17// Autofill server, which is itself backward-compatible.  The list must be kept
18// up to date with the Autofill server list.
19//
20// The list of all field types natively understood by the Autofill server.  A
21// subset of these types is used to store Autofill data in the user's profile.
22enum ServerFieldType {
23  // Server indication that it has no data for the requested field.
24  NO_SERVER_DATA = 0,
25  // Client indication that the text entered did not match anything in the
26  // personal data.
27  UNKNOWN_TYPE = 1,
28  // The "empty" type indicates that the user hasn't entered anything
29  // in this field.
30  EMPTY_TYPE = 2,
31  // Personal Information categorization types.
32  NAME_FIRST = 3,
33  NAME_MIDDLE = 4,
34  NAME_LAST = 5,
35  NAME_MIDDLE_INITIAL = 6,
36  NAME_FULL = 7,
37  NAME_SUFFIX = 8,
38  EMAIL_ADDRESS = 9,
39  PHONE_HOME_NUMBER = 10,
40  PHONE_HOME_CITY_CODE = 11,
41  PHONE_HOME_COUNTRY_CODE = 12,
42  PHONE_HOME_CITY_AND_NUMBER = 13,
43  PHONE_HOME_WHOLE_NUMBER = 14,
44
45  // Work phone numbers (values [15,19]) are deprecated.
46
47  // Fax numbers (values [20,24]) are deprecated in Chrome, but still supported
48  // by the server.
49  PHONE_FAX_NUMBER = 20,
50  PHONE_FAX_CITY_CODE = 21,
51  PHONE_FAX_COUNTRY_CODE = 22,
52  PHONE_FAX_CITY_AND_NUMBER = 23,
53  PHONE_FAX_WHOLE_NUMBER = 24,
54
55  // Cell phone numbers (values [25, 29]) are deprecated.
56
57  ADDRESS_HOME_LINE1 = 30,
58  ADDRESS_HOME_LINE2 = 31,
59  ADDRESS_HOME_APT_NUM = 32,
60  ADDRESS_HOME_CITY = 33,
61  ADDRESS_HOME_STATE = 34,
62  ADDRESS_HOME_ZIP = 35,
63  ADDRESS_HOME_COUNTRY = 36,
64  ADDRESS_BILLING_LINE1 = 37,
65  ADDRESS_BILLING_LINE2 = 38,
66  ADDRESS_BILLING_APT_NUM = 39,
67  ADDRESS_BILLING_CITY = 40,
68  ADDRESS_BILLING_STATE = 41,
69  ADDRESS_BILLING_ZIP = 42,
70  ADDRESS_BILLING_COUNTRY = 43,
71
72  // ADDRESS_SHIPPING values [44,50] are deprecated.
73
74  CREDIT_CARD_NAME = 51,
75  CREDIT_CARD_NUMBER = 52,
76  CREDIT_CARD_EXP_MONTH = 53,
77  CREDIT_CARD_EXP_2_DIGIT_YEAR = 54,
78  CREDIT_CARD_EXP_4_DIGIT_YEAR = 55,
79  CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR = 56,
80  CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR = 57,
81  CREDIT_CARD_TYPE = 58,
82  CREDIT_CARD_VERIFICATION_CODE = 59,
83
84  COMPANY_NAME = 60,
85
86  // Generic type whose default value is known.
87  FIELD_WITH_DEFAULT_VALUE = 61,
88
89  PHONE_BILLING_NUMBER = 62,
90  PHONE_BILLING_CITY_CODE = 63,
91  PHONE_BILLING_COUNTRY_CODE = 64,
92  PHONE_BILLING_CITY_AND_NUMBER = 65,
93  PHONE_BILLING_WHOLE_NUMBER = 66,
94
95  NAME_BILLING_FIRST = 67,
96  NAME_BILLING_MIDDLE = 68,
97  NAME_BILLING_LAST = 69,
98  NAME_BILLING_MIDDLE_INITIAL = 70,
99  NAME_BILLING_FULL = 71,
100  NAME_BILLING_SUFFIX = 72,
101
102  // No new types can be added without a corresponding change to the Autofill
103  // server.
104
105  MAX_VALID_FIELD_TYPE = 73,
106};
107
108enum FieldTypeGroup {
109  NO_GROUP,
110  NAME,
111  NAME_BILLING,
112  EMAIL,
113  COMPANY,
114  ADDRESS_HOME,
115  ADDRESS_BILLING,
116  PHONE_HOME,
117  PHONE_BILLING,
118  CREDIT_CARD,
119};
120
121typedef std::set<ServerFieldType> ServerFieldTypeSet;
122typedef std::map<base::string16, ServerFieldType> ServerFieldTypeMap;
123
124}  // namespace autofill
125
126#endif  // COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_TYPES_H_
127