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 13 namespace autofill { 14 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. 20 // 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. 25 NO_SERVER_DATA = 0, 26 // Client indication that the text entered did not match anything in the 27 // personal data. 28 UNKNOWN_TYPE = 1, 29 // The "empty" type indicates that the user hasn't entered anything 30 // in this field. 31 EMPTY_TYPE = 2, 32 // Personal Information categorization types. 33 NAME_FIRST = 3, 34 NAME_MIDDLE = 4, 35 NAME_LAST = 5, 36 NAME_MIDDLE_INITIAL = 6, 37 NAME_FULL = 7, 38 NAME_SUFFIX = 8, 39 EMAIL_ADDRESS = 9, 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, 45 46 // Work phone numbers (values [15,19]) are deprecated. 47 48 // Fax numbers (values [20,24]) are deprecated in Chrome, but still supported 49 // by the server. 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, 55 56 // Cell phone numbers (values [25, 29]) are deprecated. 57 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, 72 73 // ADDRESS_SHIPPING values [44,50] are deprecated. 74 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, 84 85 COMPANY_NAME = 60, 86 87 // Generic type whose default value is known. 88 FIELD_WITH_DEFAULT_VALUE = 61, 89 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, 95 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, 102 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 primarily for use by Autocheckout. 106 MERCHANT_EMAIL_SIGNUP = 73, 107 MERCHANT_PROMO_CODE = 74, 108 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. 112 PASSWORD = 75, 113 ACCOUNT_CREATION_PASSWORD = 76, 114 115 // Includes all of the lines of a street address, including newlines, e.g. 116 // 123 Main Street, 117 // Apt. #42 118 ADDRESS_HOME_STREET_ADDRESS = 77, 119 ADDRESS_BILLING_STREET_ADDRESS = 78, 120 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, 128 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, 134 135 // The third line of the street address. 136 ADDRESS_HOME_LINE3 = 83, 137 ADDRESS_BILLING_LINE3 = 84, 138 139 // No new types can be added without a corresponding change to the Autofill 140 // server. 141 142 MAX_VALID_FIELD_TYPE = 85, 143 }; 144 145 // The list of all HTML autocomplete field type hints supported by Chrome. 146 // See [ http://is.gd/whatwg_autocomplete ] for the full list of specced hints. 147 enum HtmlFieldType { 148 // Default type. 149 HTML_TYPE_UNKNOWN, 150 151 // Name types. 152 HTML_TYPE_NAME, 153 HTML_TYPE_GIVEN_NAME, 154 HTML_TYPE_ADDITIONAL_NAME, 155 HTML_TYPE_FAMILY_NAME, 156 157 // Business types. 158 HTML_TYPE_ORGANIZATION, 159 160 // Address types. 161 HTML_TYPE_STREET_ADDRESS, 162 HTML_TYPE_ADDRESS_LINE1, 163 HTML_TYPE_ADDRESS_LINE2, 164 HTML_TYPE_ADDRESS_LINE3, 165 HTML_TYPE_ADDRESS_LEVEL1, // For U.S. addresses, corresponds to the state. 166 HTML_TYPE_ADDRESS_LEVEL2, // For U.S. addresses, corresponds to the city. 167 HTML_TYPE_ADDRESS_LEVEL3, // An area that is more specific than LEVEL2. 168 HTML_TYPE_COUNTRY_CODE, // The ISO 3166-1-alpha-2 country code. 169 HTML_TYPE_COUNTRY_NAME, // The localized country name. 170 HTML_TYPE_POSTAL_CODE, 171 HTML_TYPE_FULL_ADDRESS, // The complete address, formatted for display. 172 173 // Credit card types. 174 HTML_TYPE_CREDIT_CARD_NAME, 175 HTML_TYPE_CREDIT_CARD_NUMBER, 176 HTML_TYPE_CREDIT_CARD_EXP, 177 HTML_TYPE_CREDIT_CARD_EXP_MONTH, 178 HTML_TYPE_CREDIT_CARD_EXP_YEAR, 179 HTML_TYPE_CREDIT_CARD_VERIFICATION_CODE, 180 HTML_TYPE_CREDIT_CARD_TYPE, 181 182 // Phone number types. 183 HTML_TYPE_TEL, 184 HTML_TYPE_TEL_COUNTRY_CODE, 185 HTML_TYPE_TEL_NATIONAL, 186 HTML_TYPE_TEL_AREA_CODE, 187 HTML_TYPE_TEL_LOCAL, 188 HTML_TYPE_TEL_LOCAL_PREFIX, 189 HTML_TYPE_TEL_LOCAL_SUFFIX, 190 191 // Email. 192 HTML_TYPE_EMAIL, 193 194 // Transaction details. 195 HTML_TYPE_TRANSACTION_AMOUNT, 196 HTML_TYPE_TRANSACTION_CURRENCY, 197 198 // Variants of type hints specified in the HTML specification that are 199 // inferred based on a field's 'maxlength' attribute. 200 // TODO(isherman): Remove these types, in favor of understanding maxlength 201 // when filling fields. See also: AutofillField::phone_part_. 202 HTML_TYPE_ADDITIONAL_NAME_INITIAL, 203 HTML_TYPE_CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR, 204 HTML_TYPE_CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR, 205 HTML_TYPE_CREDIT_CARD_EXP_2_DIGIT_YEAR, 206 HTML_TYPE_CREDIT_CARD_EXP_4_DIGIT_YEAR, 207 }; 208 209 // The list of all HTML autocomplete field mode hints supported by Chrome. 210 // See [ http://is.gd/whatwg_autocomplete ] for the full list of specced hints. 211 enum HtmlFieldMode { 212 HTML_MODE_NONE, 213 HTML_MODE_BILLING, 214 HTML_MODE_SHIPPING, 215 }; 216 217 enum FieldTypeGroup { 218 NO_GROUP, 219 NAME, 220 NAME_BILLING, 221 EMAIL, 222 COMPANY, 223 ADDRESS_HOME, 224 ADDRESS_BILLING, 225 PHONE_HOME, 226 PHONE_BILLING, 227 CREDIT_CARD, 228 PASSWORD_FIELD, 229 TRANSACTION, 230 }; 231 232 typedef std::set<ServerFieldType> ServerFieldTypeSet; 233 typedef std::map<base::string16, ServerFieldType> ServerFieldTypeMap; 234 235 } // namespace autofill 236 237 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_TYPES_H_ 238