blob: cfb381f96dab6509fefacc2c4a433c2731d3b994 [file] [log] [blame]
[email protected]7b37fbb2011-03-07 16:16:031// Copyright (c) 2011 The Chromium Authors. All rights reserved.
[email protected]6c178512010-01-04 20:27:252// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]e4b2fa32013-03-09 22:56:565#ifndef COMPONENTS_AUTOFILL_BROWSER_CONTACT_INFO_H_
6#define COMPONENTS_AUTOFILL_BROWSER_CONTACT_INFO_H_
[email protected]6c178512010-01-04 20:27:257
8#include <vector>
9
[email protected]43897242011-03-09 03:52:1110#include "base/gtest_prod_util.h"
[email protected]6c178512010-01-04 20:27:2511#include "base/string16.h"
[email protected]e4b2fa32013-03-09 22:56:5612#include "components/autofill/browser/field_types.h"
13#include "components/autofill/browser/form_group.h"
[email protected]6c178512010-01-04 20:27:2514
[email protected]e217c5632013-04-12 19:11:4815namespace autofill {
16
[email protected]43897242011-03-09 03:52:1117// A form group that stores name information.
18class NameInfo : public FormGroup {
[email protected]6c178512010-01-04 20:27:2519 public:
[email protected]43897242011-03-09 03:52:1120 NameInfo();
[email protected]791c8c72011-03-28 22:54:0321 NameInfo(const NameInfo& info);
[email protected]43897242011-03-09 03:52:1122 virtual ~NameInfo();
[email protected]6c178512010-01-04 20:27:2523
[email protected]43897242011-03-09 03:52:1124 NameInfo& operator=(const NameInfo& info);
25
26 // FormGroup:
[email protected]d5ca8fb2013-04-11 17:54:3127 virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE;
[email protected]6b44b582012-11-10 06:31:1828 virtual void SetRawInfo(AutofillFieldType type,
[email protected]d5ca8fb2013-04-11 17:54:3129 const base::string16& value) OVERRIDE;
[email protected]6c178512010-01-04 20:27:2530
[email protected]877535172010-03-03 01:57:0731 private:
[email protected]fcfece42011-07-22 08:29:3232 // FormGroup:
33 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE;
34
[email protected]43897242011-03-09 03:52:1135 // Returns the full name, which can include up to the first, middle, and last
36 // name.
[email protected]d5ca8fb2013-04-11 17:54:3137 base::string16 FullName() const;
[email protected]6c178512010-01-04 20:27:2538
[email protected]877535172010-03-03 01:57:0739 // Returns the middle initial if |middle_| is non-empty. Returns an empty
40 // string otherwise.
[email protected]d5ca8fb2013-04-11 17:54:3141 base::string16 MiddleInitial() const;
[email protected]6c178512010-01-04 20:27:2542
[email protected]d5ca8fb2013-04-11 17:54:3143 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]6c178512010-01-04 20:27:2546
[email protected]fcfece42011-07-22 08:29:3247 // Sets |first_|, |middle_|, and |last_| to the tokenized |full|.
48 // It is tokenized on a space only.
[email protected]d5ca8fb2013-04-11 17:54:3149 void SetFullName(const base::string16& full);
[email protected]95f41652010-06-07 22:29:2450
[email protected]d5ca8fb2013-04-11 17:54:3151 base::string16 first_;
52 base::string16 middle_;
53 base::string16 last_;
[email protected]43897242011-03-09 03:52:1154};
55
56class EmailInfo : public FormGroup {
57 public:
58 EmailInfo();
[email protected]791c8c72011-03-28 22:54:0359 EmailInfo(const EmailInfo& info);
[email protected]43897242011-03-09 03:52:1160 virtual ~EmailInfo();
61
62 EmailInfo& operator=(const EmailInfo& info);
63
64 // FormGroup:
[email protected]d5ca8fb2013-04-11 17:54:3165 virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE;
[email protected]6b44b582012-11-10 06:31:1866 virtual void SetRawInfo(AutofillFieldType type,
[email protected]d5ca8fb2013-04-11 17:54:3167 const base::string16& value) OVERRIDE;
[email protected]43897242011-03-09 03:52:1168
69 private:
[email protected]fcfece42011-07-22 08:29:3270 // FormGroup:
71 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE;
72
[email protected]d5ca8fb2013-04-11 17:54:3173 base::string16 email_;
[email protected]43897242011-03-09 03:52:1174};
75
76class CompanyInfo : public FormGroup {
77 public:
78 CompanyInfo();
[email protected]791c8c72011-03-28 22:54:0379 CompanyInfo(const CompanyInfo& info);
[email protected]43897242011-03-09 03:52:1180 virtual ~CompanyInfo();
81
82 CompanyInfo& operator=(const CompanyInfo& info);
83
84 // FormGroup:
[email protected]d5ca8fb2013-04-11 17:54:3185 virtual base::string16 GetRawInfo(AutofillFieldType type) const OVERRIDE;
[email protected]6b44b582012-11-10 06:31:1886 virtual void SetRawInfo(AutofillFieldType type,
[email protected]d5ca8fb2013-04-11 17:54:3187 const base::string16& value) OVERRIDE;
[email protected]43897242011-03-09 03:52:1188
89 private:
[email protected]fcfece42011-07-22 08:29:3290 // FormGroup:
91 virtual void GetSupportedTypes(FieldTypeSet* supported_types) const OVERRIDE;
92
[email protected]d5ca8fb2013-04-11 17:54:3193 base::string16 company_name_;
[email protected]6c178512010-01-04 20:27:2594};
95
[email protected]e217c5632013-04-12 19:11:4896} // namespace autofill
97
[email protected]e4b2fa32013-03-09 22:56:5698#endif // COMPONENTS_AUTOFILL_BROWSER_CONTACT_INFO_H_