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

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

Issue 176843022: Move UTF16ToASCII, remove WideToASCII. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/phone_number.h" 5 #include "components/autofill/core/browser/phone_number.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 // Returns the region code for this phone number, which is an ISO 3166 2-letter 26 // Returns the region code for this phone number, which is an ISO 3166 2-letter
27 // country code. The returned value is based on the |profile|; if the |profile| 27 // country code. The returned value is based on the |profile|; if the |profile|
28 // does not have a country code associated with it, falls back to the country 28 // does not have a country code associated with it, falls back to the country
29 // code corresponding to the |app_locale|. 29 // code corresponding to the |app_locale|.
30 std::string GetRegion(const AutofillProfile& profile, 30 std::string GetRegion(const AutofillProfile& profile,
31 const std::string& app_locale) { 31 const std::string& app_locale) {
32 base::string16 country_code = profile.GetRawInfo(ADDRESS_HOME_COUNTRY); 32 base::string16 country_code = profile.GetRawInfo(ADDRESS_HOME_COUNTRY);
33 if (!country_code.empty()) 33 if (!country_code.empty())
34 return UTF16ToASCII(country_code); 34 return base::UTF16ToASCII(country_code);
35 35
36 return AutofillCountry::CountryCodeForLocale(app_locale); 36 return AutofillCountry::CountryCodeForLocale(app_locale);
37 } 37 }
38 38
39 } // namespace 39 } // namespace
40 40
41 PhoneNumber::PhoneNumber(AutofillProfile* profile) 41 PhoneNumber::PhoneNumber(AutofillProfile* profile)
42 : profile_(profile) { 42 : profile_(profile) {
43 } 43 }
44 44
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 231
232 return i18n::ConstructPhoneNumber( 232 return i18n::ConstructPhoneNumber(
233 country_, city_, phone_, GetRegion(profile, app_locale), value); 233 country_, city_, phone_, GetRegion(profile, app_locale), value);
234 } 234 }
235 235
236 bool PhoneNumber::PhoneCombineHelper::IsEmpty() const { 236 bool PhoneNumber::PhoneCombineHelper::IsEmpty() const {
237 return phone_.empty() && whole_number_.empty(); 237 return phone_.empty() && whole_number_.empty();
238 } 238 }
239 239
240 } // namespace autofill 240 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698