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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_
10 #include "base/compiler_specific.h"
11 #include "base/gtest_prod_util.h"
12 #include "base/strings/string16.h"
13 #include "components/autofill/core/browser/form_group.h"
17 // A form group that stores name information.
18 class NameInfo
: public FormGroup
{
21 NameInfo(const NameInfo
& info
);
24 NameInfo
& operator=(const NameInfo
& info
);
26 // Compares |NameInfo| objects for |given_|, |middle_| and |family_| names,
27 // ignoring their case differences.
28 bool ParsedNamesAreEqual(const NameInfo
& info
) const;
31 base::string16
GetRawInfo(ServerFieldType type
) const override
;
32 void SetRawInfo(ServerFieldType type
, const base::string16
& value
) override
;
33 base::string16
GetInfo(const AutofillType
& type
,
34 const std::string
& app_locale
) const override
;
35 bool SetInfo(const AutofillType
& type
,
36 const base::string16
& value
,
37 const std::string
& app_locale
) override
;
41 void GetSupportedTypes(ServerFieldTypeSet
* supported_types
) const override
;
43 // Returns the full name, which is either |full_|, or if |full_| is empty,
44 // is composed of given, middle and family.
45 base::string16
FullName() const;
47 // Returns the middle initial if |middle_| is non-empty. Returns an empty
49 base::string16
MiddleInitial() const;
51 // Sets |given_|, |middle_|, and |family_| to the tokenized |full|.
52 void SetFullName(const base::string16
& full
);
54 base::string16 given_
;
55 base::string16 middle_
;
56 base::string16 family_
;
60 class EmailInfo
: public FormGroup
{
63 EmailInfo(const EmailInfo
& info
);
64 ~EmailInfo() override
;
66 EmailInfo
& operator=(const EmailInfo
& info
);
69 base::string16
GetRawInfo(ServerFieldType type
) const override
;
70 void SetRawInfo(ServerFieldType type
, const base::string16
& value
) override
;
74 void GetSupportedTypes(ServerFieldTypeSet
* supported_types
) const override
;
76 base::string16 email_
;
79 class CompanyInfo
: public FormGroup
{
82 CompanyInfo(const CompanyInfo
& info
);
83 ~CompanyInfo() override
;
85 CompanyInfo
& operator=(const CompanyInfo
& info
);
88 base::string16
GetRawInfo(ServerFieldType type
) const override
;
89 void SetRawInfo(ServerFieldType type
, const base::string16
& value
) override
;
93 void GetSupportedTypes(ServerFieldTypeSet
* supported_types
) const override
;
95 base::string16 company_name_
;
98 } // namespace autofill
100 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_