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. 4 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_ 7 8 #include <vector> 9 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" 14 15 namespace autofill { 16 17 // A form group that stores name information. 18 class NameInfo : public FormGroup { 19 public: 20 NameInfo(); 21 NameInfo(const NameInfo& info); 22 virtual ~NameInfo(); 23 24 NameInfo& operator=(const NameInfo& info); 25 26 // FormGroup: 27 virtual base::string16 GetRawInfo(ServerFieldType type) const OVERRIDE; 28 virtual void SetRawInfo(ServerFieldType type, 29 const base::string16& value) OVERRIDE; 30 31 private: 32 // FormGroup: 33 virtual void GetSupportedTypes( 34 ServerFieldTypeSet* supported_types) const OVERRIDE; 35 36 // Returns the full name, which can include up to the first, middle, and last 37 // name. 38 base::string16 FullName() const; 39 40 // Returns the middle initial if |middle_| is non-empty. Returns an empty 41 // string otherwise. 42 base::string16 MiddleInitial() const; 43 44 const base::string16& first() const { return first_; } 45 const base::string16& middle() const { return middle_; } 46 const base::string16& last() const { return last_; } 47 48 // Sets |first_|, |middle_|, and |last_| to the tokenized |full|. 49 // It is tokenized on a space only. 50 void SetFullName(const base::string16& full); 51 52 base::string16 first_; 53 base::string16 middle_; 54 base::string16 last_; 55 }; 56 57 class EmailInfo : public FormGroup { 58 public: 59 EmailInfo(); 60 EmailInfo(const EmailInfo& info); 61 virtual ~EmailInfo(); 62 63 EmailInfo& operator=(const EmailInfo& info); 64 65 // FormGroup: 66 virtual base::string16 GetRawInfo(ServerFieldType type) const OVERRIDE; 67 virtual void SetRawInfo(ServerFieldType type, 68 const base::string16& value) OVERRIDE; 69 70 private: 71 // FormGroup: 72 virtual void GetSupportedTypes( 73 ServerFieldTypeSet* supported_types) const OVERRIDE; 74 75 base::string16 email_; 76 }; 77 78 class CompanyInfo : public FormGroup { 79 public: 80 CompanyInfo(); 81 CompanyInfo(const CompanyInfo& info); 82 virtual ~CompanyInfo(); 83 84 CompanyInfo& operator=(const CompanyInfo& info); 85 86 // FormGroup: 87 virtual base::string16 GetRawInfo(ServerFieldType type) const OVERRIDE; 88 virtual void SetRawInfo(ServerFieldType type, 89 const base::string16& value) OVERRIDE; 90 91 private: 92 // FormGroup: 93 virtual void GetSupportedTypes( 94 ServerFieldTypeSet* supported_types) const OVERRIDE; 95 96 base::string16 company_name_; 97 }; 98 99 } // namespace autofill 100 101 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CONTACT_INFO_H_ 102