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