Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: components/autofill/core/browser/contact_info.cc

Issue 261993006: Modified to allow to preserve two-word string in first-name and last-name in autofill profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added case-insensitivity handling and unit-tests. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
27 NameInfo& NameInfo::operator=(const NameInfo& info) { 27 NameInfo& NameInfo::operator=(const NameInfo& info) {
28 if (this == &info) 28 if (this == &info)
29 return *this; 29 return *this;
30 30
31 first_ = info.first_; 31 first_ = info.first_;
32 middle_ = info.middle_; 32 middle_ = info.middle_;
33 last_ = info.last_; 33 last_ = info.last_;
34 return *this; 34 return *this;
35 } 35 }
36 36
37 bool NameInfo::operator==(const NameInfo& info) {
38 return (first_ == info.first_ && middle_ == info.middle_ &&
39 last_ == info.last_);
40 }
41
42 bool NameInfo::operator!=(const NameInfo& info) {
43 return !(*this == info);
44 }
45
46 bool NameInfo::EqualsIgnoreCase(const NameInfo& info) {
47 return (StringToLowerASCII(first_) == StringToLowerASCII(info.first_) &&
48 StringToLowerASCII(middle_) == StringToLowerASCII(info.middle_) &&
49 StringToLowerASCII(last_) == StringToLowerASCII(info.last_));
50 }
51
37 void NameInfo::GetSupportedTypes(ServerFieldTypeSet* supported_types) const { 52 void NameInfo::GetSupportedTypes(ServerFieldTypeSet* supported_types) const {
38 supported_types->insert(NAME_FIRST); 53 supported_types->insert(NAME_FIRST);
39 supported_types->insert(NAME_MIDDLE); 54 supported_types->insert(NAME_MIDDLE);
40 supported_types->insert(NAME_LAST); 55 supported_types->insert(NAME_LAST);
41 supported_types->insert(NAME_MIDDLE_INITIAL); 56 supported_types->insert(NAME_MIDDLE_INITIAL);
42 supported_types->insert(NAME_FULL); 57 supported_types->insert(NAME_FULL);
43 } 58 }
44 59
45 base::string16 NameInfo::GetRawInfo(ServerFieldType type) const { 60 base::string16 NameInfo::GetRawInfo(ServerFieldType type) const {
46 DCHECK_EQ(NAME, AutofillType(type).group()); 61 DCHECK_EQ(NAME, AutofillType(type).group());
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 return base::string16(); 212 return base::string16();
198 } 213 }
199 214
200 void CompanyInfo::SetRawInfo(ServerFieldType type, 215 void CompanyInfo::SetRawInfo(ServerFieldType type,
201 const base::string16& value) { 216 const base::string16& value) {
202 DCHECK_EQ(COMPANY_NAME, type); 217 DCHECK_EQ(COMPANY_NAME, type);
203 company_name_ = value; 218 company_name_ = value;
204 } 219 }
205 220
206 } // namespace autofill 221 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698