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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
15 #include "components/autofill/core/browser/autofill_type.h" | 15 #include "components/autofill/core/browser/autofill_type.h" |
| 16 #include "components/autofill/core/common/autofill_l10n_util.h" |
16 | 17 |
17 namespace autofill { | 18 namespace autofill { |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 const char* const name_prefixes[] = { | 22 const char* const name_prefixes[] = { |
22 "1lt", "1st", "2lt", "2nd", "3rd", "admiral", "capt", "captain", "col", | 23 "1lt", "1st", "2lt", "2nd", "3rd", "admiral", "capt", "captain", "col", |
23 "cpt", "dr", "gen", "general", "lcdr", "lt", "ltc", "ltg", "ltjg", "maj", | 24 "cpt", "dr", "gen", "general", "lcdr", "lt", "ltc", "ltg", "ltjg", "maj", |
24 "major", "mg", "mr", "mrs", "ms", "pastor", "prof", "rep", "reverend", | 25 "major", "mg", "mr", "mrs", "ms", "pastor", "prof", "rep", "reverend", |
25 "rev", "sen", "st" }; | 26 "rev", "sen", "st" }; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return *this; | 154 return *this; |
154 | 155 |
155 given_ = info.given_; | 156 given_ = info.given_; |
156 middle_ = info.middle_; | 157 middle_ = info.middle_; |
157 family_ = info.family_; | 158 family_ = info.family_; |
158 full_ = info.full_; | 159 full_ = info.full_; |
159 return *this; | 160 return *this; |
160 } | 161 } |
161 | 162 |
162 bool NameInfo::ParsedNamesAreEqual(const NameInfo& info) { | 163 bool NameInfo::ParsedNamesAreEqual(const NameInfo& info) { |
163 return (base::StringToLowerASCII(given_) == | 164 l10n::CaseInsensitiveCompare compare; |
164 base::StringToLowerASCII(info.given_) && | 165 return compare.StringsEqual(given_, info.given_) && |
165 base::StringToLowerASCII(middle_) == | 166 compare.StringsEqual(middle_, info.middle_) && |
166 base::StringToLowerASCII(info.middle_) && | 167 compare.StringsEqual(family_, info.family_); |
167 base::StringToLowerASCII(family_) == | |
168 base::StringToLowerASCII(info.family_)); | |
169 } | 168 } |
170 | 169 |
171 void NameInfo::GetSupportedTypes(ServerFieldTypeSet* supported_types) const { | 170 void NameInfo::GetSupportedTypes(ServerFieldTypeSet* supported_types) const { |
172 supported_types->insert(NAME_FIRST); | 171 supported_types->insert(NAME_FIRST); |
173 supported_types->insert(NAME_MIDDLE); | 172 supported_types->insert(NAME_MIDDLE); |
174 supported_types->insert(NAME_LAST); | 173 supported_types->insert(NAME_LAST); |
175 supported_types->insert(NAME_MIDDLE_INITIAL); | 174 supported_types->insert(NAME_MIDDLE_INITIAL); |
176 supported_types->insert(NAME_FULL); | 175 supported_types->insert(NAME_FULL); |
177 } | 176 } |
178 | 177 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 return base::string16(); | 347 return base::string16(); |
349 } | 348 } |
350 | 349 |
351 void CompanyInfo::SetRawInfo(ServerFieldType type, | 350 void CompanyInfo::SetRawInfo(ServerFieldType type, |
352 const base::string16& value) { | 351 const base::string16& value) { |
353 DCHECK_EQ(COMPANY_NAME, type); | 352 DCHECK_EQ(COMPANY_NAME, type); |
354 company_name_ = value; | 353 company_name_ = value; |
355 } | 354 } |
356 | 355 |
357 } // namespace autofill | 356 } // namespace autofill |
OLD | NEW |