OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/autofill/contact_info.h" | 5 #include "chrome/browser/autofill/contact_info.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <ostream> | 8 #include <ostream> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 void NameInfo::GetSupportedTypes(FieldTypeSet* supported_types) const { | 45 void NameInfo::GetSupportedTypes(FieldTypeSet* supported_types) const { |
46 supported_types->insert(NAME_FIRST); | 46 supported_types->insert(NAME_FIRST); |
47 supported_types->insert(NAME_MIDDLE); | 47 supported_types->insert(NAME_MIDDLE); |
48 supported_types->insert(NAME_LAST); | 48 supported_types->insert(NAME_LAST); |
49 supported_types->insert(NAME_MIDDLE_INITIAL); | 49 supported_types->insert(NAME_MIDDLE_INITIAL); |
50 supported_types->insert(NAME_FULL); | 50 supported_types->insert(NAME_FULL); |
51 } | 51 } |
52 | 52 |
53 string16 NameInfo::GetInfo(AutofillFieldType type) const { | 53 string16 NameInfo::GetRawInfo(AutofillFieldType type) const { |
54 if (type == NAME_FIRST) | 54 if (type == NAME_FIRST) |
55 return first(); | 55 return first(); |
56 | 56 |
57 if (type == NAME_MIDDLE) | 57 if (type == NAME_MIDDLE) |
58 return middle(); | 58 return middle(); |
59 | 59 |
60 if (type == NAME_LAST) | 60 if (type == NAME_LAST) |
61 return last(); | 61 return last(); |
62 | 62 |
63 if (type == NAME_MIDDLE_INITIAL) | 63 if (type == NAME_MIDDLE_INITIAL) |
64 return MiddleInitial(); | 64 return MiddleInitial(); |
65 | 65 |
66 if (type == NAME_FULL) | 66 if (type == NAME_FULL) |
67 return FullName(); | 67 return FullName(); |
68 | 68 |
69 return string16(); | 69 return string16(); |
70 } | 70 } |
71 | 71 |
72 void NameInfo::SetInfo(AutofillFieldType type, const string16& value) { | 72 void NameInfo::SetRawInfo(AutofillFieldType type, const string16& value) { |
73 DCHECK_EQ(AutofillType::NAME, AutofillType(type).group()); | 73 DCHECK_EQ(AutofillType::NAME, AutofillType(type).group()); |
74 if (type == NAME_FIRST) | 74 if (type == NAME_FIRST) |
75 first_ = value; | 75 first_ = value; |
76 else if (type == NAME_MIDDLE || type == NAME_MIDDLE_INITIAL) | 76 else if (type == NAME_MIDDLE || type == NAME_MIDDLE_INITIAL) |
77 middle_ = value; | 77 middle_ = value; |
78 else if (type == NAME_LAST) | 78 else if (type == NAME_LAST) |
79 last_ = value; | 79 last_ = value; |
80 else if (type == NAME_FULL) | 80 else if (type == NAME_FULL) |
81 SetFullName(value); | 81 SetFullName(value); |
82 else | 82 else |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return *this; | 144 return *this; |
145 | 145 |
146 email_ = info.email_; | 146 email_ = info.email_; |
147 return *this; | 147 return *this; |
148 } | 148 } |
149 | 149 |
150 void EmailInfo::GetSupportedTypes(FieldTypeSet* supported_types) const { | 150 void EmailInfo::GetSupportedTypes(FieldTypeSet* supported_types) const { |
151 supported_types->insert(EMAIL_ADDRESS); | 151 supported_types->insert(EMAIL_ADDRESS); |
152 } | 152 } |
153 | 153 |
154 string16 EmailInfo::GetInfo(AutofillFieldType type) const { | 154 string16 EmailInfo::GetRawInfo(AutofillFieldType type) const { |
155 if (type == EMAIL_ADDRESS) | 155 if (type == EMAIL_ADDRESS) |
156 return email_; | 156 return email_; |
157 | 157 |
158 return string16(); | 158 return string16(); |
159 } | 159 } |
160 | 160 |
161 void EmailInfo::SetInfo(AutofillFieldType type, const string16& value) { | 161 void EmailInfo::SetRawInfo(AutofillFieldType type, const string16& value) { |
162 DCHECK_EQ(EMAIL_ADDRESS, type); | 162 DCHECK_EQ(EMAIL_ADDRESS, type); |
163 email_ = value; | 163 email_ = value; |
164 } | 164 } |
165 | 165 |
166 CompanyInfo::CompanyInfo() {} | 166 CompanyInfo::CompanyInfo() {} |
167 | 167 |
168 CompanyInfo::CompanyInfo(const CompanyInfo& info) : FormGroup() { | 168 CompanyInfo::CompanyInfo(const CompanyInfo& info) : FormGroup() { |
169 *this = info; | 169 *this = info; |
170 } | 170 } |
171 | 171 |
172 CompanyInfo::~CompanyInfo() {} | 172 CompanyInfo::~CompanyInfo() {} |
173 | 173 |
174 CompanyInfo& CompanyInfo::operator=(const CompanyInfo& info) { | 174 CompanyInfo& CompanyInfo::operator=(const CompanyInfo& info) { |
175 if (this == &info) | 175 if (this == &info) |
176 return *this; | 176 return *this; |
177 | 177 |
178 company_name_ = info.company_name_; | 178 company_name_ = info.company_name_; |
179 return *this; | 179 return *this; |
180 } | 180 } |
181 | 181 |
182 void CompanyInfo::GetSupportedTypes(FieldTypeSet* supported_types) const { | 182 void CompanyInfo::GetSupportedTypes(FieldTypeSet* supported_types) const { |
183 supported_types->insert(COMPANY_NAME); | 183 supported_types->insert(COMPANY_NAME); |
184 } | 184 } |
185 | 185 |
186 string16 CompanyInfo::GetInfo(AutofillFieldType type) const { | 186 string16 CompanyInfo::GetRawInfo(AutofillFieldType type) const { |
187 if (type == COMPANY_NAME) | 187 if (type == COMPANY_NAME) |
188 return company_name_; | 188 return company_name_; |
189 | 189 |
190 return string16(); | 190 return string16(); |
191 } | 191 } |
192 | 192 |
193 void CompanyInfo::SetInfo(AutofillFieldType type, const string16& value) { | 193 void CompanyInfo::SetRawInfo(AutofillFieldType type, const string16& value) { |
194 DCHECK_EQ(COMPANY_NAME, type); | 194 DCHECK_EQ(COMPANY_NAME, type); |
195 company_name_ = value; | 195 company_name_ = value; |
196 } | 196 } |
OLD | NEW |