Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: chrome/browser/autofill/autofill_type.cc

Issue 6650014: Autofill extend profiles to include multi-valued fields, part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/autofill/autofill_type.h" 5 #include "chrome/browser/autofill/autofill_type.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 namespace { 10 namespace {
11 11
12 const AutofillType::AutofillTypeDefinition kUnknownAutofillTypeDefinition = { 12 const AutofillType::AutofillTypeDefinition kUnknownAutofillTypeDefinition = {
13 /* UNKNOWN_TYPE */ AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP 13 /* UNKNOWN_TYPE */ AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP
14 }; 14 };
15 15
16 AutofillType::AutofillTypeDefinition kAutofillTypeDefinitions[] = { 16 AutofillType::AutofillTypeDefinition kAutofillTypeDefinitions[] = {
17 // NO_SERVER_DATA 17 // NO_SERVER_DATA
18 { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP }, 18 { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP },
19 // UNKNOWN_TYPE 19 // UNKNOWN_TYPE
20 kUnknownAutofillTypeDefinition, 20 kUnknownAutofillTypeDefinition,
21 // EMPTY_TYPE 21 // EMPTY_TYPE
22 { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP }, 22 { AutofillType::NO_GROUP, AutofillType::NO_SUBGROUP },
23 23
24 // NAME_FIRST 24 // NAME_FIRST
25 { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, 25 { AutofillType::NAME, AutofillType::NO_SUBGROUP },
26 // NAME_MIDDLE 26 // NAME_MIDDLE
27 { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, 27 { AutofillType::NAME, AutofillType::NO_SUBGROUP },
28 // NAME_LAST 28 // NAME_LAST
29 { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, 29 { AutofillType::NAME, AutofillType::NO_SUBGROUP },
30 // NAME_MIDDLE_INITIAL 30 // NAME_MIDDLE_INITIAL
31 { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, 31 { AutofillType::NAME, AutofillType::NO_SUBGROUP },
32 // NAME_FULL 32 // NAME_FULL
33 { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, 33 { AutofillType::NAME, AutofillType::NO_SUBGROUP },
34 // NAME_SUFFIX 34 // NAME_SUFFIX
35 { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, 35 { AutofillType::NAME, AutofillType::NO_SUBGROUP },
36 36
37 // EMAIL_ADDRESS 37 // EMAIL_ADDRESS
38 { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, 38 { AutofillType::EMAIL, AutofillType::NO_SUBGROUP },
39 39
40 // PHONE_HOME_NUMBER 40 // PHONE_HOME_NUMBER
41 { AutofillType::PHONE_HOME, AutofillType::PHONE_NUMBER }, 41 { AutofillType::PHONE_HOME, AutofillType::PHONE_NUMBER },
42 // PHONE_HOME_CITY_CODE 42 // PHONE_HOME_CITY_CODE
43 { AutofillType::PHONE_HOME, AutofillType::PHONE_CITY_CODE }, 43 { AutofillType::PHONE_HOME, AutofillType::PHONE_CITY_CODE },
44 // PHONE_HOME_COUNTRY_CODE 44 // PHONE_HOME_COUNTRY_CODE
45 { AutofillType::PHONE_HOME, AutofillType::PHONE_COUNTRY_CODE }, 45 { AutofillType::PHONE_HOME, AutofillType::PHONE_COUNTRY_CODE },
46 // PHONE_HOME_CITY_AND_NUMBER 46 // PHONE_HOME_CITY_AND_NUMBER
47 { AutofillType::PHONE_HOME, AutofillType::PHONE_CITY_AND_NUMBER }, 47 { AutofillType::PHONE_HOME, AutofillType::PHONE_CITY_AND_NUMBER },
48 // PHONE_HOME_WHOLE_NUMBER 48 // PHONE_HOME_WHOLE_NUMBER
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR 125 // CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR
126 { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP }, 126 { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP },
127 // CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR 127 // CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR
128 { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP }, 128 { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP },
129 // CREDIT_CARD_TYPE 129 // CREDIT_CARD_TYPE
130 { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP }, 130 { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP },
131 // CREDIT_CARD_VERIFICATION_CODE 131 // CREDIT_CARD_VERIFICATION_CODE
132 { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP }, 132 { AutofillType::CREDIT_CARD, AutofillType::NO_SUBGROUP },
133 133
134 // COMPANY_NAME 134 // COMPANY_NAME
135 { AutofillType::CONTACT_INFO, AutofillType::NO_SUBGROUP }, 135 { AutofillType::COMPANY, AutofillType::NO_SUBGROUP },
136 }; 136 };
137 137
138 } // namespace 138 } // namespace
139 139
140 AutofillType::AutofillType(AutofillFieldType field_type) { 140 AutofillType::AutofillType(AutofillFieldType field_type) {
141 if ((field_type < NO_SERVER_DATA || field_type >= MAX_VALID_FIELD_TYPE) || 141 if ((field_type < NO_SERVER_DATA || field_type >= MAX_VALID_FIELD_TYPE) ||
142 (field_type >= 15 && field_type <= 19) || 142 (field_type >= 15 && field_type <= 19) ||
143 (field_type >= 25 && field_type <= 29) || 143 (field_type >= 25 && field_type <= 29) ||
144 (field_type >= 44 && field_type <= 50)) 144 (field_type >= 44 && field_type <= 50))
145 field_type_ = UNKNOWN_TYPE; 145 field_type_ = UNKNOWN_TYPE;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 if (str == "CREDIT_CARD_TYPE") 385 if (str == "CREDIT_CARD_TYPE")
386 return CREDIT_CARD_TYPE; 386 return CREDIT_CARD_TYPE;
387 if (str == "CREDIT_CARD_VERIFICATION_CODE") 387 if (str == "CREDIT_CARD_VERIFICATION_CODE")
388 return CREDIT_CARD_VERIFICATION_CODE; 388 return CREDIT_CARD_VERIFICATION_CODE;
389 if (str == "COMPANY_NAME") 389 if (str == "COMPANY_NAME")
390 return COMPANY_NAME; 390 return COMPANY_NAME;
391 391
392 NOTREACHED() << "Unknown AutofillFieldType " << str; 392 NOTREACHED() << "Unknown AutofillFieldType " << str;
393 return UNKNOWN_TYPE; 393 return UNKNOWN_TYPE;
394 } 394 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_type.h ('k') | chrome/browser/autofill/autofill_type_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698