Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / components / autofill / core / browser / contact_info.h
blob55ca8abc2f2515d3a59c52540d560778f8ee9fac
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_
8 #include <vector>
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"
15 namespace autofill {
17 // A form group that stores name information.
18 class NameInfo : public FormGroup {
19 public:
20 NameInfo();
21 NameInfo(const NameInfo& info);
22 ~NameInfo() override;
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;
30 // FormGroup:
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;
39 private:
40 // FormGroup:
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
48 // string otherwise.
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_;
57 base::string16 full_;
60 class EmailInfo : public FormGroup {
61 public:
62 EmailInfo();
63 EmailInfo(const EmailInfo& info);
64 ~EmailInfo() override;
66 EmailInfo& operator=(const EmailInfo& info);
68 // FormGroup:
69 base::string16 GetRawInfo(ServerFieldType type) const override;
70 void SetRawInfo(ServerFieldType type, const base::string16& value) override;
72 private:
73 // FormGroup:
74 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override;
76 base::string16 email_;
79 class CompanyInfo : public FormGroup {
80 public:
81 CompanyInfo();
82 CompanyInfo(const CompanyInfo& info);
83 ~CompanyInfo() override;
85 CompanyInfo& operator=(const CompanyInfo& info);
87 // FormGroup:
88 base::string16 GetRawInfo(ServerFieldType type) const override;
89 void SetRawInfo(ServerFieldType type, const base::string16& value) override;
91 private:
92 // FormGroup:
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_