autofill_type.h revision c407dc5cd9bdc5668497f21b26b09d988ab439de
1// Copyright (c) 2009 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 CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_
6#define CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_
7
8#include <map>
9#include <set>
10#include <string>
11
12#include "base/string16.h"
13#include "chrome/browser/autofill/field_types.h"
14
15// The high-level description of AutoFill types, used to categorize form fields
16// and for associating form fields with form values in the Web Database.
17class AutoFillType {
18 public:
19  enum FieldTypeGroup {
20    NO_GROUP,
21    CONTACT_INFO,
22    ADDRESS_HOME,
23    ADDRESS_BILLING,
24    PHONE_HOME,
25    PHONE_FAX,
26    CREDIT_CARD,
27  };
28
29  enum FieldTypeSubGroup {
30    NO_SUBGROUP,
31    // Address subgroups.
32    ADDRESS_LINE1,
33    ADDRESS_LINE2,
34    ADDRESS_APT_NUM,
35    ADDRESS_CITY,
36    ADDRESS_STATE,
37    ADDRESS_ZIP,
38    ADDRESS_COUNTRY,
39
40    // Phone subgroups.
41    PHONE_NUMBER,
42    PHONE_CITY_CODE,
43    PHONE_COUNTRY_CODE,
44    PHONE_CITY_AND_NUMBER,
45    PHONE_WHOLE_NUMBER
46  };
47
48  struct AutoFillTypeDefinition {
49    FieldTypeGroup group;
50    FieldTypeSubGroup subgroup;
51  };
52
53  explicit AutoFillType(AutoFillFieldType field_type);
54  AutoFillType(const AutoFillType& autofill_type);
55  AutoFillType& operator=(const AutoFillType& autofill_type);
56
57  AutoFillFieldType field_type() const;
58  FieldTypeGroup group() const;
59  FieldTypeSubGroup subgroup() const;
60
61 private:
62  AutoFillFieldType field_type_;
63};
64
65typedef AutoFillType::FieldTypeGroup FieldTypeGroup;
66typedef AutoFillType::FieldTypeSubGroup FieldTypeSubGroup;
67typedef std::set<AutoFillFieldType> FieldTypeSet;
68typedef std::map<string16, AutoFillFieldType> FieldTypeMap;
69
70#endif  // CHROME_BROWSER_AUTOFILL_AUTOFILL_TYPE_H_
71