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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return initial; | 114 return initial; |
115 } | 115 } |
116 | 116 |
117 void NameInfo::SetFullName(const base::string16& full) { | 117 void NameInfo::SetFullName(const base::string16& full) { |
118 // Clear the names. | 118 // Clear the names. |
119 first_ = base::string16(); | 119 first_ = base::string16(); |
120 middle_ = base::string16(); | 120 middle_ = base::string16(); |
121 last_ = base::string16(); | 121 last_ = base::string16(); |
122 | 122 |
123 std::vector<base::string16> full_name_tokens; | 123 std::vector<base::string16> full_name_tokens; |
124 Tokenize(full, ASCIIToUTF16(" "), &full_name_tokens); | 124 Tokenize(full, base::ASCIIToUTF16(" "), &full_name_tokens); |
125 | 125 |
126 // There are four possibilities: empty; first name; first and last names; | 126 // There are four possibilities: empty; first name; first and last names; |
127 // first, middle (possibly multiple strings) and then the last name. | 127 // first, middle (possibly multiple strings) and then the last name. |
128 if (full_name_tokens.size() > 0) { | 128 if (full_name_tokens.size() > 0) { |
129 first_ = full_name_tokens[0]; | 129 first_ = full_name_tokens[0]; |
130 if (full_name_tokens.size() > 1) { | 130 if (full_name_tokens.size() > 1) { |
131 last_ = full_name_tokens.back(); | 131 last_ = full_name_tokens.back(); |
132 if (full_name_tokens.size() > 2) { | 132 if (full_name_tokens.size() > 2) { |
133 full_name_tokens.erase(full_name_tokens.begin()); | 133 full_name_tokens.erase(full_name_tokens.begin()); |
134 full_name_tokens.pop_back(); | 134 full_name_tokens.pop_back(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 return base::string16(); | 197 return base::string16(); |
198 } | 198 } |
199 | 199 |
200 void CompanyInfo::SetRawInfo(ServerFieldType type, | 200 void CompanyInfo::SetRawInfo(ServerFieldType type, |
201 const base::string16& value) { | 201 const base::string16& value) { |
202 DCHECK_EQ(COMPANY_NAME, type); | 202 DCHECK_EQ(COMPANY_NAME, type); |
203 company_name_ = value; | 203 company_name_ = value; |
204 } | 204 } |
205 | 205 |
206 } // namespace autofill | 206 } // namespace autofill |
OLD | NEW |