| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 bool Address::SetInfo(const AutofillType& type, | 155 bool Address::SetInfo(const AutofillType& type, |
| 156 const base::string16& value, | 156 const base::string16& value, |
| 157 const std::string& app_locale) { | 157 const std::string& app_locale) { |
| 158 if (type.html_type() == HTML_TYPE_COUNTRY_CODE) { | 158 if (type.html_type() == HTML_TYPE_COUNTRY_CODE) { |
| 159 if (!value.empty() && (value.size() != 2u || !base::IsStringASCII(value))) { | 159 if (!value.empty() && (value.size() != 2u || !base::IsStringASCII(value))) { |
| 160 country_code_ = std::string(); | 160 country_code_ = std::string(); |
| 161 return false; | 161 return false; |
| 162 } | 162 } |
| 163 | 163 |
| 164 country_code_ = base::StringToUpperASCII(base::UTF16ToASCII(value)); | 164 country_code_ = base::ToUpperASCII(base::UTF16ToASCII(value)); |
| 165 return true; | 165 return true; |
| 166 } else if (type.html_type() == HTML_TYPE_FULL_ADDRESS) { | 166 } else if (type.html_type() == HTML_TYPE_FULL_ADDRESS) { |
| 167 // Parsing a full address is too hard. | 167 // Parsing a full address is too hard. |
| 168 return false; | 168 return false; |
| 169 } | 169 } |
| 170 | 170 |
| 171 ServerFieldType storable_type = type.GetStorableType(); | 171 ServerFieldType storable_type = type.GetStorableType(); |
| 172 if (storable_type == ADDRESS_HOME_COUNTRY && !value.empty()) { | 172 if (storable_type == ADDRESS_HOME_COUNTRY && !value.empty()) { |
| 173 country_code_ = AutofillCountry::GetCountryCode(value, app_locale); | 173 country_code_ = AutofillCountry::GetCountryCode(value, app_locale); |
| 174 return !country_code_.empty(); | 174 return !country_code_.empty(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 supported_types->insert(ADDRESS_HOME_COUNTRY); | 213 supported_types->insert(ADDRESS_HOME_COUNTRY); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void Address::TrimStreetAddress() { | 216 void Address::TrimStreetAddress() { |
| 217 while (!street_address_.empty() && street_address_.back().empty()) { | 217 while (!street_address_.empty() && street_address_.back().empty()) { |
| 218 street_address_.pop_back(); | 218 street_address_.pop_back(); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 | 221 |
| 222 } // namespace autofill | 222 } // namespace autofill |
| OLD | NEW |