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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_TYPES_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_TYPES_H_
11 #include "base/strings/string16.h"
15 // NOTE: This list MUST not be modified except to keep it synchronized with the
16 // Autofill server's version. The server aggregates and stores these types over
17 // several versions, so we must remain fully compatible with the Autofill
18 // server, which is itself backward-compatible. The list must be kept up to
19 // date with the Autofill server list.
21 // The list of all field types natively understood by the Autofill server. A
22 // subset of these types is used to store Autofill data in the user's profile.
23 enum ServerFieldType {
24 // Server indication that it has no data for the requested field.
26 // Client indication that the text entered did not match anything in the
29 // The "empty" type indicates that the user hasn't entered anything
32 // Personal Information categorization types.
36 NAME_MIDDLE_INITIAL = 6,
40 PHONE_HOME_NUMBER = 10,
41 PHONE_HOME_CITY_CODE = 11,
42 PHONE_HOME_COUNTRY_CODE = 12,
43 PHONE_HOME_CITY_AND_NUMBER = 13,
44 PHONE_HOME_WHOLE_NUMBER = 14,
46 // Work phone numbers (values [15,19]) are deprecated.
48 // Fax numbers (values [20,24]) are deprecated in Chrome, but still supported
50 PHONE_FAX_NUMBER = 20,
51 PHONE_FAX_CITY_CODE = 21,
52 PHONE_FAX_COUNTRY_CODE = 22,
53 PHONE_FAX_CITY_AND_NUMBER = 23,
54 PHONE_FAX_WHOLE_NUMBER = 24,
56 // Cell phone numbers (values [25, 29]) are deprecated.
58 ADDRESS_HOME_LINE1 = 30,
59 ADDRESS_HOME_LINE2 = 31,
60 ADDRESS_HOME_APT_NUM = 32,
61 ADDRESS_HOME_CITY = 33,
62 ADDRESS_HOME_STATE = 34,
63 ADDRESS_HOME_ZIP = 35,
64 ADDRESS_HOME_COUNTRY = 36,
65 ADDRESS_BILLING_LINE1 = 37,
66 ADDRESS_BILLING_LINE2 = 38,
67 ADDRESS_BILLING_APT_NUM = 39,
68 ADDRESS_BILLING_CITY = 40,
69 ADDRESS_BILLING_STATE = 41,
70 ADDRESS_BILLING_ZIP = 42,
71 ADDRESS_BILLING_COUNTRY = 43,
73 // ADDRESS_SHIPPING values [44,50] are deprecated.
75 CREDIT_CARD_NAME = 51,
76 CREDIT_CARD_NUMBER = 52,
77 CREDIT_CARD_EXP_MONTH = 53,
78 CREDIT_CARD_EXP_2_DIGIT_YEAR = 54,
79 CREDIT_CARD_EXP_4_DIGIT_YEAR = 55,
80 CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR = 56,
81 CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR = 57,
82 CREDIT_CARD_TYPE = 58,
83 CREDIT_CARD_VERIFICATION_CODE = 59,
87 // Generic type whose default value is known.
88 FIELD_WITH_DEFAULT_VALUE = 61,
90 PHONE_BILLING_NUMBER = 62,
91 PHONE_BILLING_CITY_CODE = 63,
92 PHONE_BILLING_COUNTRY_CODE = 64,
93 PHONE_BILLING_CITY_AND_NUMBER = 65,
94 PHONE_BILLING_WHOLE_NUMBER = 66,
96 NAME_BILLING_FIRST = 67,
97 NAME_BILLING_MIDDLE = 68,
98 NAME_BILLING_LAST = 69,
99 NAME_BILLING_MIDDLE_INITIAL = 70,
100 NAME_BILLING_FULL = 71,
101 NAME_BILLING_SUFFIX = 72,
103 // Field types for options generally found in merchant buyflows. Given that
104 // these are likely to be filled out differently on a case by case basis,
105 // they are here primarly for use by Autocheckout.
106 MERCHANT_EMAIL_SIGNUP = 73,
107 MERCHANT_PROMO_CODE = 74,
109 // Field types for the password fields. PASSWORD is the default type for all
110 // password fields. ACCOUNT_CREATION_PASSWORD is the first password field in
111 // an account creation form and will trigger password generation.
113 ACCOUNT_CREATION_PASSWORD = 76,
115 // Includes all of the lines of a street address, including newlines, e.g.
118 ADDRESS_HOME_STREET_ADDRESS = 77,
119 ADDRESS_BILLING_STREET_ADDRESS = 78,
121 // A sorting code is similar to a postal code. However, whereas a postal code
122 // normally refers to a single geographical location, a sorting code often
123 // does not. Instead, a sorting code is assigned to an organization, which
124 // might be geographically distributed. The most prominent example of a
125 // sorting code system is CEDEX in France.
126 ADDRESS_HOME_SORTING_CODE = 79,
127 ADDRESS_BILLING_SORTING_CODE = 80,
129 // A dependent locality is a subunit of a locality, where a "locality" is
130 // roughly equivalent to a city. Examples of dependent localities include
131 // inner-city districts and suburbs.
132 ADDRESS_HOME_DEPENDENT_LOCALITY = 81,
133 ADDRESS_BILLING_DEPENDENT_LOCALITY = 82,
135 // No new types can be added without a corresponding change to the Autofill
138 MAX_VALID_FIELD_TYPE = 83,
141 // The list of all HTML autocomplete field type hints supported by Chrome.
142 // See [ http://is.gd/whatwg_autocomplete ] for the full list of specced hints.
149 HTML_TYPE_GIVEN_NAME,
150 HTML_TYPE_ADDITIONAL_NAME,
151 HTML_TYPE_FAMILY_NAME,
154 HTML_TYPE_ORGANIZATION,
157 HTML_TYPE_STREET_ADDRESS,
158 HTML_TYPE_ADDRESS_LINE1,
159 HTML_TYPE_ADDRESS_LINE2,
160 HTML_TYPE_LOCALITY, // For U.S. addresses, corresponds to the city.
161 HTML_TYPE_REGION, // For U.S. addresses, corresponds to the state.
162 HTML_TYPE_COUNTRY_CODE, // The ISO 3166-1-alpha-2 country code.
163 HTML_TYPE_COUNTRY_NAME, // The localized country name.
164 HTML_TYPE_POSTAL_CODE,
166 // Credit card types.
167 HTML_TYPE_CREDIT_CARD_NAME,
168 HTML_TYPE_CREDIT_CARD_NUMBER,
169 HTML_TYPE_CREDIT_CARD_EXP,
170 HTML_TYPE_CREDIT_CARD_EXP_MONTH,
171 HTML_TYPE_CREDIT_CARD_EXP_YEAR,
172 HTML_TYPE_CREDIT_CARD_VERIFICATION_CODE,
173 HTML_TYPE_CREDIT_CARD_TYPE,
175 // Phone number types.
177 HTML_TYPE_TEL_COUNTRY_CODE,
178 HTML_TYPE_TEL_NATIONAL,
179 HTML_TYPE_TEL_AREA_CODE,
181 HTML_TYPE_TEL_LOCAL_PREFIX,
182 HTML_TYPE_TEL_LOCAL_SUFFIX,
187 // Variants of type hints specified in the HTML specification that are
188 // inferred based on a field's 'maxlength' attribute.
189 // TODO(isherman): Remove these types, in favor of understanding maxlength
190 // when filling fields. See also: AutofillField::phone_part_.
191 HTML_TYPE_ADDITIONAL_NAME_INITIAL,
192 HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR,
193 HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR,
194 HTML_TYPE_CREDIT_CARD_EXP_2_DIGIT_YEAR,
195 HTML_TYPE_CREDIT_CARD_EXP_4_DIGIT_YEAR,
198 // The list of all HTML autocomplete field mode hints supported by Chrome.
199 // See [ http://is.gd/whatwg_autocomplete ] for the full list of specced hints.
206 enum FieldTypeGroup {
220 typedef std::set<ServerFieldType> ServerFieldTypeSet;
221 typedef std::map<base::string16, ServerFieldType> ServerFieldTypeMap;
223 } // namespace autofill
225 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_TYPES_H_