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

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

Issue 8169009: Remove FieldTypeSubGroups from the AutofillType class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests compile Created 9 years, 2 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
« no previous file with comments | « chrome/browser/autofill/autofill_profile.cc ('k') | chrome/browser/autofill/autofill_type.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_ 5 #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_
6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_ 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 12
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "chrome/browser/autofill/field_types.h" 14 #include "chrome/browser/autofill/field_types.h"
15 15
16 // The high-level description of Autofill types, used to categorize form fields 16 // The high-level description of Autofill types, used to categorize form fields
17 // and for associating form fields with form values in the Web Database. 17 // and for associating form fields with form values in the Web Database.
18 class AutofillType { 18 class AutofillType {
19 public: 19 public:
20 enum FieldTypeGroup { 20 enum FieldTypeGroup {
21 NO_GROUP, 21 NO_GROUP,
22 NAME, 22 NAME,
23 EMAIL, 23 EMAIL,
24 COMPANY, 24 COMPANY,
25 ADDRESS_HOME, 25 ADDRESS_HOME,
26 ADDRESS_BILLING, 26 ADDRESS_BILLING,
27 PHONE_HOME, 27 PHONE,
28 CREDIT_CARD, 28 CREDIT_CARD,
29 }; 29 };
30 30
31 enum FieldTypeSubGroup {
32 NO_SUBGROUP,
33 // Address subgroups.
34 ADDRESS_LINE1,
35 ADDRESS_LINE2,
36 ADDRESS_APT_NUM,
37 ADDRESS_CITY,
38 ADDRESS_STATE,
39 ADDRESS_ZIP,
40 ADDRESS_COUNTRY,
41
42 // Phone subgroups.
43 PHONE_NUMBER,
44 PHONE_CITY_CODE,
45 PHONE_COUNTRY_CODE,
46 PHONE_CITY_AND_NUMBER,
47 PHONE_WHOLE_NUMBER
48 };
49
50 struct AutofillTypeDefinition {
51 FieldTypeGroup group;
52 FieldTypeSubGroup subgroup;
53 };
54
55 explicit AutofillType(AutofillFieldType field_type); 31 explicit AutofillType(AutofillFieldType field_type);
56 AutofillType(const AutofillType& autofill_type); 32 AutofillType(const AutofillType& autofill_type);
57 AutofillType& operator=(const AutofillType& autofill_type); 33 AutofillType& operator=(const AutofillType& autofill_type);
58 34
59 AutofillFieldType field_type() const; 35 AutofillFieldType field_type() const;
60 FieldTypeGroup group() const; 36 FieldTypeGroup group() const;
61 FieldTypeSubGroup subgroup() const;
62 37
63 // Maps |field_type| to a field type that can be directly stored in a profile 38 // Maps |field_type| to a field type that can be directly stored in a profile
64 // (in the sense that it makes sense to call |AutofillProfile::SetInfo()| with 39 // (in the sense that it makes sense to call |AutofillProfile::SetInfo()| with
65 // the returned field type as the first parameter). 40 // the returned field type as the first parameter).
66 static AutofillFieldType GetEquivalentFieldType(AutofillFieldType field_type); 41 static AutofillFieldType GetEquivalentFieldType(AutofillFieldType field_type);
67 42
68 // Utilities for serializing and deserializing an |AutofillFieldType|. 43 // Utilities for serializing and deserializing an |AutofillFieldType|.
69 static std::string FieldTypeToString(AutofillFieldType field_type); 44 static std::string FieldTypeToString(AutofillFieldType field_type);
70 static AutofillFieldType StringToFieldType(const std::string& str); 45 static AutofillFieldType StringToFieldType(const std::string& str);
71 46
72 private: 47 private:
73 AutofillFieldType field_type_; 48 AutofillFieldType field_type_;
74 }; 49 };
75 50
76 typedef AutofillType::FieldTypeGroup FieldTypeGroup; 51 typedef AutofillType::FieldTypeGroup FieldTypeGroup;
77 typedef AutofillType::FieldTypeSubGroup FieldTypeSubGroup;
78 typedef std::set<AutofillFieldType> FieldTypeSet; 52 typedef std::set<AutofillFieldType> FieldTypeSet;
79 typedef std::map<string16, AutofillFieldType> FieldTypeMap; 53 typedef std::map<string16, AutofillFieldType> FieldTypeMap;
80 54
81 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_ 55 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autofill_profile.cc ('k') | chrome/browser/autofill/autofill_type.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698