OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_AUTOFILL_BROWSER_CONTACT_INFO_H_ | |
6 #define COMPONENTS_AUTOFILL_BROWSER_CONTACT_INFO_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "base/gtest_prod_util.h" | |
12 #include "base/strings/string16.h" | |
13 #include "components/autofill/browser/field_types.h" | |
14 #include "components/autofill/browser/form_group.h" | |
15 | |
16 namespace autofill { | |
17 | |
18 // A form group that stores name information. | |
19 class NameInfo : public FormGroup { | |
20 public: | |
21 NameInfo(); | |
22 NameInfo(const NameInfo& info); | |
23 virtual ~NameInfo(); | |
24 | |
25 NameInfo& operator=(const NameInfo& info); | |
26 | |
27 // FormGroup: | |
28 virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; | |
29 virtual void SetRawInfo(AutofillFieldType type, | |
30 const base::string16& value) OVERRIDE; | |
31 | |
32 private: | |
33 // FormGroup: | |
34 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; | |
35 | |
36 // Returns the full name, which can include up to the first, middle, and last | |
37 // name. | |
38 base::string16 FullName() const; | |
39 | |
40 // Returns the middle initial if |middle_| is non-empty. Returns an empty | |
41 // string otherwise. | |
42 base::string16 MiddleInitial() const; | |
43 | |
44 const base::string16& first() const { return first_; } | |
45 const base::string16& middle() const { return middle_; } | |
46 const base::string16& last() const { return last_; } | |
47 | |
48 // Sets |first_|, |middle_|, and |last_| to the tokenized |full|. | |
49 // It is tokenized on a space only. | |
50 void SetFullName(const base::string16& full); | |
51 | |
52 base::string16 first_; | |
53 base::string16 middle_; | |
54 base::string16 last_; | |
55 }; | |
56 | |
57 class EmailInfo : public FormGroup { | |
58 public: | |
59 EmailInfo(); | |
60 EmailInfo(const EmailInfo& info); | |
61 virtual ~EmailInfo(); | |
62 | |
63 EmailInfo& operator=(const EmailInfo& info); | |
64 | |
65 // FormGroup: | |
66 virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; | |
67 virtual void SetRawInfo(AutofillFieldType type, | |
68 const base::string16& value) OVERRIDE; | |
69 | |
70 private: | |
71 // FormGroup: | |
72 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; | |
73 | |
74 base::string16 email_; | |
75 }; | |
76 | |
77 class CompanyInfo : public FormGroup { | |
78 public: | |
79 CompanyInfo(); | |
80 CompanyInfo(const CompanyInfo& info); | |
81 virtual ~CompanyInfo(); | |
82 | |
83 CompanyInfo& operator=(const CompanyInfo& info); | |
84 | |
85 // FormGroup: | |
86 virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; | |
87 virtual void SetRawInfo(AutofillFieldType type, | |
88 const base::string16& value) OVERRIDE; | |
89 | |
90 private: | |
91 // FormGroup: | |
92 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; | |
93 | |
94 base::string16 company_name_; | |
95 }; | |
96 | |
97 } // namespace autofill | |
98 | |
99 #endif // COMPONENTS_AUTOFILL_BROWSER_CONTACT_INFO_H_ | |
OLD | NEW |