| 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/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "components/autofill/core/browser/form_group.h" | 12 #include "components/autofill/core/browser/form_group.h" |
| 13 | 13 |
| 14 namespace autofill { | 14 namespace autofill { |
| 15 | 15 |
| 16 // A form group that stores name information. | 16 // A form group that stores name information. |
| 17 class NameInfo : public FormGroup { | 17 class NameInfo : public FormGroup { |
| 18 public: | 18 public: |
| 19 NameInfo(); | 19 NameInfo(); |
| 20 NameInfo(const NameInfo& info); | 20 NameInfo(const NameInfo& info); |
| 21 ~NameInfo() override; | 21 ~NameInfo() override; |
| 22 | 22 |
| 23 NameInfo& operator=(const NameInfo& info); | 23 NameInfo& operator=(const NameInfo& info); |
| 24 bool operator==(const NameInfo& other) const; |
| 25 bool operator!=(const NameInfo& other) const { return !operator==(other); } |
| 24 | 26 |
| 25 // Compares |NameInfo| objects for |given_|, |middle_| and |family_| names. | 27 // Compares |NameInfo| objects for |given_|, |middle_| and |family_| names. |
| 26 // The comparison is case sensitive. | 28 // The comparison is case sensitive. |
| 27 bool ParsedNamesAreEqual(const NameInfo& info) const; | 29 bool ParsedNamesAreEqual(const NameInfo& info) const; |
| 28 | 30 |
| 29 // For every non-empty NameInfo part in |new_name|, the corresponding NameInfo | 31 // For every non-empty NameInfo part in |new_name|, the corresponding NameInfo |
| 30 // part in | this | is overwritten.Special logic so that a middle initial may | 32 // part in | this | is overwritten.Special logic so that a middle initial may |
| 31 // not overwrite a full middle name. | 33 // not overwrite a full middle name. |
| 32 void OverwriteName(const NameInfo& new_name); | 34 void OverwriteName(const NameInfo& new_name); |
| 33 | 35 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 64 base::string16 full_; | 66 base::string16 full_; |
| 65 }; | 67 }; |
| 66 | 68 |
| 67 class EmailInfo : public FormGroup { | 69 class EmailInfo : public FormGroup { |
| 68 public: | 70 public: |
| 69 EmailInfo(); | 71 EmailInfo(); |
| 70 EmailInfo(const EmailInfo& info); | 72 EmailInfo(const EmailInfo& info); |
| 71 ~EmailInfo() override; | 73 ~EmailInfo() override; |
| 72 | 74 |
| 73 EmailInfo& operator=(const EmailInfo& info); | 75 EmailInfo& operator=(const EmailInfo& info); |
| 76 bool operator==(const EmailInfo& other) const; |
| 77 bool operator!=(const EmailInfo& other) const { return !operator==(other); } |
| 74 | 78 |
| 75 // FormGroup: | 79 // FormGroup: |
| 76 base::string16 GetRawInfo(ServerFieldType type) const override; | 80 base::string16 GetRawInfo(ServerFieldType type) const override; |
| 77 void SetRawInfo(ServerFieldType type, const base::string16& value) override; | 81 void SetRawInfo(ServerFieldType type, const base::string16& value) override; |
| 78 | 82 |
| 79 private: | 83 private: |
| 80 // FormGroup: | 84 // FormGroup: |
| 81 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; | 85 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; |
| 82 | 86 |
| 83 base::string16 email_; | 87 base::string16 email_; |
| 84 }; | 88 }; |
| 85 | 89 |
| 86 class CompanyInfo : public FormGroup { | 90 class CompanyInfo : public FormGroup { |
| 87 public: | 91 public: |
| 88 CompanyInfo(); | 92 CompanyInfo(); |
| 89 CompanyInfo(const CompanyInfo& info); | 93 CompanyInfo(const CompanyInfo& info); |
| 90 ~CompanyInfo() override; | 94 ~CompanyInfo() override; |
| 91 | 95 |
| 92 CompanyInfo& operator=(const CompanyInfo& info); | 96 CompanyInfo& operator=(const CompanyInfo& info); |
| 97 bool operator==(const CompanyInfo& other) const; |
| 98 bool operator!=(const CompanyInfo& other) const { return !operator==(other); } |
| 93 | 99 |
| 94 // FormGroup: | 100 // FormGroup: |
| 95 base::string16 GetRawInfo(ServerFieldType type) const override; | 101 base::string16 GetRawInfo(ServerFieldType type) const override; |
| 96 void SetRawInfo(ServerFieldType type, const base::string16& value) override; | 102 void SetRawInfo(ServerFieldType type, const base::string16& value) override; |
| 97 | 103 |
| 98 private: | 104 private: |
| 99 // FormGroup: | 105 // FormGroup: |
| 100 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; | 106 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; |
| 101 | 107 |
| 102 base::string16 company_name_; | 108 base::string16 company_name_; |
| 103 }; | 109 }; |
| 104 | 110 |
| 105 } // namespace autofill | 111 } // namespace autofill |
| 106 | 112 |
| 107 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_ | 113 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_ |
| OLD | NEW |