OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "components/autofill/core/browser/form_group.h" | 13 #include "components/autofill/core/browser/form_group.h" |
14 | 14 |
15 namespace autofill { | 15 namespace autofill { |
16 | 16 |
17 // A form group that stores name information. | 17 // A form group that stores name information. |
18 class NameInfo : public FormGroup { | 18 class NameInfo : public FormGroup { |
19 public: | 19 public: |
20 NameInfo(); | 20 NameInfo(); |
21 NameInfo(const NameInfo& info); | 21 NameInfo(const NameInfo& info); |
22 virtual ~NameInfo(); | 22 ~NameInfo() override; |
23 | 23 |
24 NameInfo& operator=(const NameInfo& info); | 24 NameInfo& operator=(const NameInfo& info); |
25 | 25 |
26 // Compares |NameInfo| objects for |given_|, |middle_| and |family_| names, | 26 // Compares |NameInfo| objects for |given_|, |middle_| and |family_| names, |
27 // ignoring their case differences. | 27 // ignoring their case differences. |
28 bool ParsedNamesAreEqual(const NameInfo& info); | 28 bool ParsedNamesAreEqual(const NameInfo& info); |
29 | 29 |
30 // FormGroup: | 30 // FormGroup: |
31 virtual base::string16 GetRawInfo(ServerFieldType type) const override; | 31 base::string16 GetRawInfo(ServerFieldType type) const override; |
32 virtual void SetRawInfo(ServerFieldType type, | 32 void SetRawInfo(ServerFieldType type, const base::string16& value) override; |
33 const base::string16& value) override; | 33 base::string16 GetInfo(const AutofillType& type, |
34 virtual base::string16 GetInfo(const AutofillType& type, | 34 const std::string& app_locale) const override; |
35 const std::string& app_locale) const override; | 35 bool SetInfo(const AutofillType& type, |
36 virtual bool SetInfo(const AutofillType& type, | 36 const base::string16& value, |
37 const base::string16& value, | 37 const std::string& app_locale) override; |
38 const std::string& app_locale) override; | |
39 | 38 |
40 private: | 39 private: |
41 // FormGroup: | 40 // FormGroup: |
42 virtual void GetSupportedTypes( | 41 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; |
43 ServerFieldTypeSet* supported_types) const override; | |
44 | 42 |
45 // Returns the full name, which is either |full_|, or if |full_| is empty, | 43 // Returns the full name, which is either |full_|, or if |full_| is empty, |
46 // is composed of given, middle and family. | 44 // is composed of given, middle and family. |
47 base::string16 FullName() const; | 45 base::string16 FullName() const; |
48 | 46 |
49 // Returns the middle initial if |middle_| is non-empty. Returns an empty | 47 // Returns the middle initial if |middle_| is non-empty. Returns an empty |
50 // string otherwise. | 48 // string otherwise. |
51 base::string16 MiddleInitial() const; | 49 base::string16 MiddleInitial() const; |
52 | 50 |
53 // Sets |given_|, |middle_|, and |family_| to the tokenized |full|. | 51 // Sets |given_|, |middle_|, and |family_| to the tokenized |full|. |
54 void SetFullName(const base::string16& full); | 52 void SetFullName(const base::string16& full); |
55 | 53 |
56 base::string16 given_; | 54 base::string16 given_; |
57 base::string16 middle_; | 55 base::string16 middle_; |
58 base::string16 family_; | 56 base::string16 family_; |
59 base::string16 full_; | 57 base::string16 full_; |
60 }; | 58 }; |
61 | 59 |
62 class EmailInfo : public FormGroup { | 60 class EmailInfo : public FormGroup { |
63 public: | 61 public: |
64 EmailInfo(); | 62 EmailInfo(); |
65 EmailInfo(const EmailInfo& info); | 63 EmailInfo(const EmailInfo& info); |
66 virtual ~EmailInfo(); | 64 ~EmailInfo() override; |
67 | 65 |
68 EmailInfo& operator=(const EmailInfo& info); | 66 EmailInfo& operator=(const EmailInfo& info); |
69 | 67 |
70 // FormGroup: | 68 // FormGroup: |
71 virtual base::string16 GetRawInfo(ServerFieldType type) const override; | 69 base::string16 GetRawInfo(ServerFieldType type) const override; |
72 virtual void SetRawInfo(ServerFieldType type, | 70 void SetRawInfo(ServerFieldType type, const base::string16& value) override; |
73 const base::string16& value) override; | |
74 | 71 |
75 private: | 72 private: |
76 // FormGroup: | 73 // FormGroup: |
77 virtual void GetSupportedTypes( | 74 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; |
78 ServerFieldTypeSet* supported_types) const override; | |
79 | 75 |
80 base::string16 email_; | 76 base::string16 email_; |
81 }; | 77 }; |
82 | 78 |
83 class CompanyInfo : public FormGroup { | 79 class CompanyInfo : public FormGroup { |
84 public: | 80 public: |
85 CompanyInfo(); | 81 CompanyInfo(); |
86 CompanyInfo(const CompanyInfo& info); | 82 CompanyInfo(const CompanyInfo& info); |
87 virtual ~CompanyInfo(); | 83 ~CompanyInfo() override; |
88 | 84 |
89 CompanyInfo& operator=(const CompanyInfo& info); | 85 CompanyInfo& operator=(const CompanyInfo& info); |
90 | 86 |
91 // FormGroup: | 87 // FormGroup: |
92 virtual base::string16 GetRawInfo(ServerFieldType type) const override; | 88 base::string16 GetRawInfo(ServerFieldType type) const override; |
93 virtual void SetRawInfo(ServerFieldType type, | 89 void SetRawInfo(ServerFieldType type, const base::string16& value) override; |
94 const base::string16& value) override; | |
95 | 90 |
96 private: | 91 private: |
97 // FormGroup: | 92 // FormGroup: |
98 virtual void GetSupportedTypes( | 93 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; |
99 ServerFieldTypeSet* supported_types) const override; | |
100 | 94 |
101 base::string16 company_name_; | 95 base::string16 company_name_; |
102 }; | 96 }; |
103 | 97 |
104 } // namespace autofill | 98 } // namespace autofill |
105 | 99 |
106 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_ | 100 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_ |
OLD | NEW |