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

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

Issue 13697002: Make autofill's Address store country using the country code so that app locale isn't needed for th… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/phone_number.h" 5 #include "components/autofill/browser/phone_number.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 16 matching lines...) Expand all
27 void StripPunctuation(string16* number) { 27 void StripPunctuation(string16* number) {
28 RemoveChars(*number, kPhoneNumberSeparators, number); 28 RemoveChars(*number, kPhoneNumberSeparators, number);
29 } 29 }
30 30
31 // Returns the region code for this phone number, which is an ISO 3166 2-letter 31 // Returns the region code for this phone number, which is an ISO 3166 2-letter
32 // country code. The returned value is based on the |profile|; if the |profile| 32 // country code. The returned value is based on the |profile|; if the |profile|
33 // does not have a country code associated with it, falls back to the country 33 // does not have a country code associated with it, falls back to the country
34 // code corresponding to the |app_locale|. 34 // code corresponding to the |app_locale|.
35 std::string GetRegion(const AutofillProfile& profile, 35 std::string GetRegion(const AutofillProfile& profile,
36 const std::string& app_locale) { 36 const std::string& app_locale) {
37 std::string country_code = profile.CountryCode(); 37 string16 country_code = profile.GetRawInfo(ADDRESS_HOME_COUNTRY);
38 if (!country_code.empty()) 38 if (!country_code.empty())
39 return country_code; 39 return WideToASCII(country_code);
Ilya Sherman 2013/04/05 05:18:01 I think you want UTF16ToASCII here.
jam 2013/04/05 06:45:54 yeah that was a mistake, fixed already
40 40
41 return AutofillCountry::CountryCodeForLocale(app_locale); 41 return AutofillCountry::CountryCodeForLocale(app_locale);
42 } 42 }
43 43
44 } // namespace 44 } // namespace
45 45
46 PhoneNumber::PhoneNumber(AutofillProfile* profile) 46 PhoneNumber::PhoneNumber(AutofillProfile* profile)
47 : profile_(profile) { 47 : profile_(profile) {
48 } 48 }
49 49
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 return true; 229 return true;
230 } 230 }
231 231
232 return autofill_i18n::ConstructPhoneNumber( 232 return autofill_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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698