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

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

Issue 113403006: Update some uses of char16 to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | Annotate | Revision Log
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 case ADDRESS_HOME_ZIP: 114 case ADDRESS_HOME_ZIP:
115 zip_code_ = value; 115 zip_code_ = value;
116 break; 116 break;
117 117
118 case ADDRESS_HOME_SORTING_CODE: 118 case ADDRESS_HOME_SORTING_CODE:
119 sorting_code_ = value; 119 sorting_code_ = value;
120 break; 120 break;
121 121
122 case ADDRESS_HOME_STREET_ADDRESS: 122 case ADDRESS_HOME_STREET_ADDRESS:
123 base::SplitString(value, char16('\n'), &street_address_); 123 base::SplitString(value, base::char16('\n'), &street_address_);
124 break; 124 break;
125 125
126 default: 126 default:
127 NOTREACHED(); 127 NOTREACHED();
128 } 128 }
129 } 129 }
130 130
131 base::string16 Address::GetInfo(const AutofillType& type, 131 base::string16 Address::GetInfo(const AutofillType& type,
132 const std::string& app_locale) const { 132 const std::string& app_locale) const {
133 if (type.html_type() == HTML_TYPE_COUNTRY_CODE) 133 if (type.html_type() == HTML_TYPE_COUNTRY_CODE)
(...skipping 23 matching lines...) Expand all
157 if (storable_type == ADDRESS_HOME_COUNTRY && !value.empty()) { 157 if (storable_type == ADDRESS_HOME_COUNTRY && !value.empty()) {
158 country_code_ = AutofillCountry::GetCountryCode(value, app_locale); 158 country_code_ = AutofillCountry::GetCountryCode(value, app_locale);
159 return !country_code_.empty(); 159 return !country_code_.empty();
160 } 160 }
161 161
162 // If the address doesn't have any newlines, don't attempt to parse it into 162 // 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 163 // lines, since this is potentially a user-entered address in the user's own
164 // format, so the code would have to rely on iffy heuristics at best. 164 // format, so the code would have to rely on iffy heuristics at best.
165 // Instead, just give up when importing addresses like this. 165 // Instead, just give up when importing addresses like this.
166 if (storable_type == ADDRESS_HOME_STREET_ADDRESS && !value.empty() && 166 if (storable_type == ADDRESS_HOME_STREET_ADDRESS && !value.empty() &&
167 value.find(char16('\n')) == base::string16::npos) { 167 value.find(base::char16('\n')) == base::string16::npos) {
168 street_address_.clear(); 168 street_address_.clear();
169 return false; 169 return false;
170 } 170 }
171 171
172 SetRawInfo(storable_type, value); 172 SetRawInfo(storable_type, value);
173 173
174 // Likewise, give up when importing addresses with any entirely blank lines. 174 // Likewise, give up when importing addresses with any entirely blank lines.
175 // There's a good chance that this formatting is not intentional, but it's 175 // There's a good chance that this formatting is not intentional, but it's
176 // also not obviously safe to just strip the newlines. 176 // also not obviously safe to just strip the newlines.
177 if (storable_type == ADDRESS_HOME_STREET_ADDRESS && 177 if (storable_type == ADDRESS_HOME_STREET_ADDRESS &&
(...skipping 29 matching lines...) Expand all
207 supported_types->insert(ADDRESS_HOME_COUNTRY); 207 supported_types->insert(ADDRESS_HOME_COUNTRY);
208 } 208 }
209 209
210 void Address::TrimStreetAddress() { 210 void Address::TrimStreetAddress() {
211 while (!street_address_.empty() && street_address_.back().empty()) { 211 while (!street_address_.empty() && street_address_.back().empty()) {
212 street_address_.pop_back(); 212 street_address_.pop_back();
213 } 213 }
214 } 214 }
215 215
216 } // namespace autofill 216 } // namespace autofill
OLDNEW
« no previous file with comments | « cloud_print/service/win/chrome_launcher.cc ('k') | components/autofill/core/browser/autofill_field.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698