Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(649)

Side by Side Diff: components/autofill/core/browser/address.cc

Issue 1280473002: Update ToLower/UpperASCII API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/installer/util/l10n_string_util.cc ('k') | components/autofill/core/browser/autofill_country.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698