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/address.h" | 5 #include "components/autofill/core/browser/address.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 case ADDRESS_HOME_ZIP: | 124 case ADDRESS_HOME_ZIP: |
125 zip_code_ = value; | 125 zip_code_ = value; |
126 break; | 126 break; |
127 | 127 |
128 case ADDRESS_HOME_SORTING_CODE: | 128 case ADDRESS_HOME_SORTING_CODE: |
129 sorting_code_ = value; | 129 sorting_code_ = value; |
130 break; | 130 break; |
131 | 131 |
132 case ADDRESS_HOME_STREET_ADDRESS: | 132 case ADDRESS_HOME_STREET_ADDRESS: |
133 base::SplitString(value, base::char16('\n'), &street_address_); | 133 street_address_ = base::SplitString( |
| 134 value, base::ASCIIToUTF16("\n"), |
| 135 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
134 break; | 136 break; |
135 | 137 |
136 default: | 138 default: |
137 NOTREACHED(); | 139 NOTREACHED(); |
138 } | 140 } |
139 } | 141 } |
140 | 142 |
141 base::string16 Address::GetInfo(const AutofillType& type, | 143 base::string16 Address::GetInfo(const AutofillType& type, |
142 const std::string& app_locale) const { | 144 const std::string& app_locale) const { |
143 if (type.html_type() == HTML_TYPE_COUNTRY_CODE) | 145 if (type.html_type() == HTML_TYPE_COUNTRY_CODE) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 supported_types->insert(ADDRESS_HOME_COUNTRY); | 213 supported_types->insert(ADDRESS_HOME_COUNTRY); |
212 } | 214 } |
213 | 215 |
214 void Address::TrimStreetAddress() { | 216 void Address::TrimStreetAddress() { |
215 while (!street_address_.empty() && street_address_.back().empty()) { | 217 while (!street_address_.empty() && street_address_.back().empty()) { |
216 street_address_.pop_back(); | 218 street_address_.pop_back(); |
217 } | 219 } |
218 } | 220 } |
219 | 221 |
220 } // namespace autofill | 222 } // namespace autofill |
OLD | NEW |