[email protected] | 7b37fbb | 2011-03-07 16:16:03 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 6c17851 | 2010-01-04 20:27:25 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | e4b2fa3 | 2013-03-09 22:56:56 | [diff] [blame] | 5 | #ifndef COMPONENTS_AUTOFILL_BROWSER_CONTACT_INFO_H_ |
6 | #define COMPONENTS_AUTOFILL_BROWSER_CONTACT_INFO_H_ | ||||
[email protected] | 6c17851 | 2010-01-04 20:27:25 | [diff] [blame] | 7 | |
8 | #include <vector> | ||||
9 | |||||
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 10 | #include "base/gtest_prod_util.h" |
[email protected] | 6c17851 | 2010-01-04 20:27:25 | [diff] [blame] | 11 | #include "base/string16.h" |
[email protected] | e4b2fa3 | 2013-03-09 22:56:56 | [diff] [blame] | 12 | #include "components/autofill/browser/field_types.h" |
13 | #include "components/autofill/browser/form_group.h" | ||||
[email protected] | 6c17851 | 2010-01-04 20:27:25 | [diff] [blame] | 14 | |
[email protected] | e217c563 | 2013-04-12 19:11:48 | [diff] [blame^] | 15 | namespace autofill { |
16 | |||||
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 17 | // A form group that stores name information. |
18 | class NameInfo : public FormGroup { | ||||
[email protected] | 6c17851 | 2010-01-04 20:27:25 | [diff] [blame] | 19 | public: |
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 20 | NameInfo(); |
[email protected] | 791c8c7 | 2011-03-28 22:54:03 | [diff] [blame] | 21 | NameInfo(const NameInfo& info); |
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 22 | virtual ~NameInfo(); |
[email protected] | 6c17851 | 2010-01-04 20:27:25 | [diff] [blame] | 23 | |
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 24 | NameInfo& operator=(const NameInfo& info); |
25 | |||||
26 | // FormGroup: | ||||
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 27 | virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; |
[email protected] | 6b44b58 | 2012-11-10 06:31:18 | [diff] [blame] | 28 | virtual void SetRawInfo(AutofillFieldType type, |
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 29 | const base::string16& value) OVERRIDE; |
[email protected] | 6c17851 | 2010-01-04 20:27:25 | [diff] [blame] | 30 | |
[email protected] | 87753517 | 2010-03-03 01:57:07 | [diff] [blame] | 31 | private: |
[email protected] | fcfece4 | 2011-07-22 08:29:32 | [diff] [blame] | 32 | // FormGroup: |
33 | virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; | ||||
34 | |||||
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 35 | // Returns the full name, which can include up to the first, middle, and last |
36 | // name. | ||||
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 37 | base::string16 FullName() const; |
[email protected] | 6c17851 | 2010-01-04 20:27:25 | [diff] [blame] | 38 | |
[email protected] | 87753517 | 2010-03-03 01:57:07 | [diff] [blame] | 39 | // Returns the middle initial if |middle_| is non-empty. Returns an empty |
40 | // string otherwise. | ||||
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 41 | base::string16 MiddleInitial() const; |
[email protected] | 6c17851 | 2010-01-04 20:27:25 | [diff] [blame] | 42 | |
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 43 | const base::string16& first() const { return first_; } |
44 | const base::string16& middle() const { return middle_; } | ||||
45 | const base::string16& last() const { return last_; } | ||||
[email protected] | 6c17851 | 2010-01-04 20:27:25 | [diff] [blame] | 46 | |
[email protected] | fcfece4 | 2011-07-22 08:29:32 | [diff] [blame] | 47 | // Sets |first_|, |middle_|, and |last_| to the tokenized |full|. |
48 | // It is tokenized on a space only. | ||||
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 49 | void SetFullName(const base::string16& full); |
[email protected] | 95f4165 | 2010-06-07 22:29:24 | [diff] [blame] | 50 | |
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 51 | base::string16 first_; |
52 | base::string16 middle_; | ||||
53 | base::string16 last_; | ||||
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 54 | }; |
55 | |||||
56 | class EmailInfo : public FormGroup { | ||||
57 | public: | ||||
58 | EmailInfo(); | ||||
[email protected] | 791c8c7 | 2011-03-28 22:54:03 | [diff] [blame] | 59 | EmailInfo(const EmailInfo& info); |
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 60 | virtual ~EmailInfo(); |
61 | |||||
62 | EmailInfo& operator=(const EmailInfo& info); | ||||
63 | |||||
64 | // FormGroup: | ||||
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 65 | virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; |
[email protected] | 6b44b58 | 2012-11-10 06:31:18 | [diff] [blame] | 66 | virtual void SetRawInfo(AutofillFieldType type, |
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 67 | const base::string16& value) OVERRIDE; |
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 68 | |
69 | private: | ||||
[email protected] | fcfece4 | 2011-07-22 08:29:32 | [diff] [blame] | 70 | // FormGroup: |
71 | virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; | ||||
72 | |||||
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 73 | base::string16 email_; |
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 74 | }; |
75 | |||||
76 | class CompanyInfo : public FormGroup { | ||||
77 | public: | ||||
78 | CompanyInfo(); | ||||
[email protected] | 791c8c7 | 2011-03-28 22:54:03 | [diff] [blame] | 79 | CompanyInfo(const CompanyInfo& info); |
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 80 | virtual ~CompanyInfo(); |
81 | |||||
82 | CompanyInfo& operator=(const CompanyInfo& info); | ||||
83 | |||||
84 | // FormGroup: | ||||
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 85 | virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE; |
[email protected] | 6b44b58 | 2012-11-10 06:31:18 | [diff] [blame] | 86 | virtual void SetRawInfo(AutofillFieldType type, |
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 87 | const base::string16& value) OVERRIDE; |
[email protected] | 4389724 | 2011-03-09 03:52:11 | [diff] [blame] | 88 | |
89 | private: | ||||
[email protected] | fcfece4 | 2011-07-22 08:29:32 | [diff] [blame] | 90 | // FormGroup: |
91 | virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE; | ||||
92 | |||||
[email protected] | d5ca8fb | 2013-04-11 17:54:31 | [diff] [blame] | 93 | base::string16 company_name_; |
[email protected] | 6c17851 | 2010-01-04 20:27:25 | [diff] [blame] | 94 | }; |
95 | |||||
[email protected] | e217c563 | 2013-04-12 19:11:48 | [diff] [blame^] | 96 | } // namespace autofill |
97 | |||||
[email protected] | e4b2fa3 | 2013-03-09 22:56:56 | [diff] [blame] | 98 | #endif // COMPONENTS_AUTOFILL_BROWSER_CONTACT_INFO_H_ |