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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 const base::string16& value, | 144 const base::string16& value, |
145 const std::string& app_locale) { | 145 const std::string& app_locale) { |
146 if (type.html_type() == HTML_TYPE_COUNTRY_CODE) { | 146 if (type.html_type() == HTML_TYPE_COUNTRY_CODE) { |
147 if (!value.empty() && (value.size() != 2u || !base::IsStringASCII(value))) { | 147 if (!value.empty() && (value.size() != 2u || !base::IsStringASCII(value))) { |
148 country_code_ = std::string(); | 148 country_code_ = std::string(); |
149 return false; | 149 return false; |
150 } | 150 } |
151 | 151 |
152 country_code_ = StringToUpperASCII(base::UTF16ToASCII(value)); | 152 country_code_ = StringToUpperASCII(base::UTF16ToASCII(value)); |
153 return true; | 153 return true; |
| 154 } else if (type.html_type() == HTML_TYPE_FULL_ADDRESS) { |
| 155 // Parsing a full address is too hard. |
| 156 return false; |
154 } | 157 } |
155 | 158 |
156 ServerFieldType storable_type = type.GetStorableType(); | 159 ServerFieldType storable_type = type.GetStorableType(); |
157 if (storable_type == ADDRESS_HOME_COUNTRY && !value.empty()) { | 160 if (storable_type == ADDRESS_HOME_COUNTRY && !value.empty()) { |
158 country_code_ = AutofillCountry::GetCountryCode(value, app_locale); | 161 country_code_ = AutofillCountry::GetCountryCode(value, app_locale); |
159 return !country_code_.empty(); | 162 return !country_code_.empty(); |
160 } | 163 } |
161 | 164 |
162 // If the address doesn't have any newlines, don't attempt to parse it into | 165 // If the address doesn't have any newlines, don't attempt to parse it into |
163 // lines, since this is potentially a user-entered address in the user's own | 166 // lines, since this is potentially a user-entered address in the user's own |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 supported_types->insert(ADDRESS_HOME_COUNTRY); | 210 supported_types->insert(ADDRESS_HOME_COUNTRY); |
208 } | 211 } |
209 | 212 |
210 void Address::TrimStreetAddress() { | 213 void Address::TrimStreetAddress() { |
211 while (!street_address_.empty() && street_address_.back().empty()) { | 214 while (!street_address_.empty() && street_address_.back().empty()) { |
212 street_address_.pop_back(); | 215 street_address_.pop_back(); |
213 } | 216 } |
214 } | 217 } |
215 | 218 |
216 } // namespace autofill | 219 } // namespace autofill |
OLD | NEW |