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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 while (name_tokens.size() >= 1 && | 118 while (name_tokens.size() >= 1 && |
119 ContainsString(family_name_prefixes, | 119 ContainsString(family_name_prefixes, |
120 arraysize(family_name_prefixes), | 120 arraysize(family_name_prefixes), |
121 name_tokens.back())) { | 121 name_tokens.back())) { |
122 reverse_family_tokens.push_back(name_tokens.back()); | 122 reverse_family_tokens.push_back(name_tokens.back()); |
123 name_tokens.pop_back(); | 123 name_tokens.pop_back(); |
124 } | 124 } |
125 | 125 |
126 std::vector<base::string16> family_tokens(reverse_family_tokens.rbegin(), | 126 std::vector<base::string16> family_tokens(reverse_family_tokens.rbegin(), |
127 reverse_family_tokens.rend()); | 127 reverse_family_tokens.rend()); |
128 parts.family = JoinString(family_tokens, base::char16(' ')); | 128 parts.family = base::JoinString(family_tokens, base::ASCIIToUTF16(" ")); |
129 | 129 |
130 // Take the last remaining token as the middle name (if there are at least 2 | 130 // Take the last remaining token as the middle name (if there are at least 2 |
131 // tokens). | 131 // tokens). |
132 if (name_tokens.size() >= 2) { | 132 if (name_tokens.size() >= 2) { |
133 parts.middle = name_tokens.back(); | 133 parts.middle = name_tokens.back(); |
134 name_tokens.pop_back(); | 134 name_tokens.pop_back(); |
135 } | 135 } |
136 | 136 |
137 // Remainder is given name. | 137 // Remainder is given name. |
138 parts.given = JoinString(name_tokens, base::char16(' ')); | 138 parts.given = base::JoinString(name_tokens, base::ASCIIToUTF16(" ")); |
139 | 139 |
140 return parts; | 140 return parts; |
141 } | 141 } |
142 | 142 |
143 } // namespace | 143 } // namespace |
144 | 144 |
145 NameInfo::NameInfo() {} | 145 NameInfo::NameInfo() {} |
146 | 146 |
147 NameInfo::NameInfo(const NameInfo& info) : FormGroup() { | 147 NameInfo::NameInfo(const NameInfo& info) : FormGroup() { |
148 *this = info; | 148 *this = info; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 std::vector<base::string16> full_name; | 255 std::vector<base::string16> full_name; |
256 if (!given_.empty()) | 256 if (!given_.empty()) |
257 full_name.push_back(given_); | 257 full_name.push_back(given_); |
258 | 258 |
259 if (!middle_.empty()) | 259 if (!middle_.empty()) |
260 full_name.push_back(middle_); | 260 full_name.push_back(middle_); |
261 | 261 |
262 if (!family_.empty()) | 262 if (!family_.empty()) |
263 full_name.push_back(family_); | 263 full_name.push_back(family_); |
264 | 264 |
265 return JoinString(full_name, ' '); | 265 return base::JoinString(full_name, base::ASCIIToUTF16(" ")); |
266 } | 266 } |
267 | 267 |
268 base::string16 NameInfo::MiddleInitial() const { | 268 base::string16 NameInfo::MiddleInitial() const { |
269 if (middle_.empty()) | 269 if (middle_.empty()) |
270 return base::string16(); | 270 return base::string16(); |
271 | 271 |
272 base::string16 middle_name(middle_); | 272 base::string16 middle_name(middle_); |
273 base::string16 initial; | 273 base::string16 initial; |
274 initial.push_back(middle_name[0]); | 274 initial.push_back(middle_name[0]); |
275 return initial; | 275 return initial; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 return base::string16(); | 348 return base::string16(); |
349 } | 349 } |
350 | 350 |
351 void CompanyInfo::SetRawInfo(ServerFieldType type, | 351 void CompanyInfo::SetRawInfo(ServerFieldType type, |
352 const base::string16& value) { | 352 const base::string16& value) { |
353 DCHECK_EQ(COMPANY_NAME, type); | 353 DCHECK_EQ(COMPANY_NAME, type); |
354 company_name_ = value; | 354 company_name_ = value; |
355 } | 355 } |
356 | 356 |
357 } // namespace autofill | 357 } // namespace autofill |
OLD | NEW |