| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 "components/autofill/core/browser/contact_info.h" | 5 #include "components/autofill/core/browser/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 19 matching lines...) Expand all Loading... |
| 30 if (this == &info) | 30 if (this == &info) |
| 31 return *this; | 31 return *this; |
| 32 | 32 |
| 33 given_ = info.given_; | 33 given_ = info.given_; |
| 34 middle_ = info.middle_; | 34 middle_ = info.middle_; |
| 35 family_ = info.family_; | 35 family_ = info.family_; |
| 36 full_ = info.full_; | 36 full_ = info.full_; |
| 37 return *this; | 37 return *this; |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool NameInfo::operator==(const NameInfo& other) const { |
| 41 if (this == &other) |
| 42 return true; |
| 43 return given_ == other.given_ && middle_ == other.middle_ && |
| 44 family_ == other.family_ && full_ == other.full_; |
| 45 } |
| 46 |
| 40 bool NameInfo::ParsedNamesAreEqual(const NameInfo& info) const { | 47 bool NameInfo::ParsedNamesAreEqual(const NameInfo& info) const { |
| 41 return given_ == info.given_ && middle_ == info.middle_ && | 48 return given_ == info.given_ && middle_ == info.middle_ && |
| 42 family_ == info.family_; | 49 family_ == info.family_; |
| 43 } | 50 } |
| 44 | 51 |
| 45 void NameInfo::OverwriteName(const NameInfo& new_name) { | 52 void NameInfo::OverwriteName(const NameInfo& new_name) { |
| 46 if (!new_name.given_.empty()) | 53 if (!new_name.given_.empty()) |
| 47 given_ = new_name.given_; | 54 given_ = new_name.given_; |
| 48 | 55 |
| 49 // For the middle name, don't overwrite a full middle name with an initial. | 56 // For the middle name, don't overwrite a full middle name with an initial. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 EmailInfo::~EmailInfo() {} | 199 EmailInfo::~EmailInfo() {} |
| 193 | 200 |
| 194 EmailInfo& EmailInfo::operator=(const EmailInfo& info) { | 201 EmailInfo& EmailInfo::operator=(const EmailInfo& info) { |
| 195 if (this == &info) | 202 if (this == &info) |
| 196 return *this; | 203 return *this; |
| 197 | 204 |
| 198 email_ = info.email_; | 205 email_ = info.email_; |
| 199 return *this; | 206 return *this; |
| 200 } | 207 } |
| 201 | 208 |
| 209 bool EmailInfo::operator==(const EmailInfo& other) const { |
| 210 return this == &other || email_ == other.email_; |
| 211 } |
| 212 |
| 202 void EmailInfo::GetSupportedTypes(ServerFieldTypeSet* supported_types) const { | 213 void EmailInfo::GetSupportedTypes(ServerFieldTypeSet* supported_types) const { |
| 203 supported_types->insert(EMAIL_ADDRESS); | 214 supported_types->insert(EMAIL_ADDRESS); |
| 204 } | 215 } |
| 205 | 216 |
| 206 base::string16 EmailInfo::GetRawInfo(ServerFieldType type) const { | 217 base::string16 EmailInfo::GetRawInfo(ServerFieldType type) const { |
| 207 if (type == EMAIL_ADDRESS) | 218 if (type == EMAIL_ADDRESS) |
| 208 return email_; | 219 return email_; |
| 209 | 220 |
| 210 return base::string16(); | 221 return base::string16(); |
| 211 } | 222 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 224 CompanyInfo::~CompanyInfo() {} | 235 CompanyInfo::~CompanyInfo() {} |
| 225 | 236 |
| 226 CompanyInfo& CompanyInfo::operator=(const CompanyInfo& info) { | 237 CompanyInfo& CompanyInfo::operator=(const CompanyInfo& info) { |
| 227 if (this == &info) | 238 if (this == &info) |
| 228 return *this; | 239 return *this; |
| 229 | 240 |
| 230 company_name_ = info.company_name_; | 241 company_name_ = info.company_name_; |
| 231 return *this; | 242 return *this; |
| 232 } | 243 } |
| 233 | 244 |
| 245 bool CompanyInfo::operator==(const CompanyInfo& other) const { |
| 246 return this == &other || company_name_ == other.company_name_; |
| 247 } |
| 248 |
| 234 void CompanyInfo::GetSupportedTypes(ServerFieldTypeSet* supported_types) const { | 249 void CompanyInfo::GetSupportedTypes(ServerFieldTypeSet* supported_types) const { |
| 235 supported_types->insert(COMPANY_NAME); | 250 supported_types->insert(COMPANY_NAME); |
| 236 } | 251 } |
| 237 | 252 |
| 238 base::string16 CompanyInfo::GetRawInfo(ServerFieldType type) const { | 253 base::string16 CompanyInfo::GetRawInfo(ServerFieldType type) const { |
| 239 if (type == COMPANY_NAME) | 254 if (type == COMPANY_NAME) |
| 240 return company_name_; | 255 return company_name_; |
| 241 | 256 |
| 242 return base::string16(); | 257 return base::string16(); |
| 243 } | 258 } |
| 244 | 259 |
| 245 void CompanyInfo::SetRawInfo(ServerFieldType type, | 260 void CompanyInfo::SetRawInfo(ServerFieldType type, |
| 246 const base::string16& value) { | 261 const base::string16& value) { |
| 247 DCHECK_EQ(COMPANY_NAME, type); | 262 DCHECK_EQ(COMPANY_NAME, type); |
| 248 company_name_ = value; | 263 company_name_ = value; |
| 249 } | 264 } |
| 250 | 265 |
| 251 } // namespace autofill | 266 } // namespace autofill |
| OLD | NEW |