Chromium Code Reviews| Index: chrome/browser/autofill/phone_number_i18n.cc |
| =================================================================== |
| --- chrome/browser/autofill/phone_number_i18n.cc (revision 111991) |
| +++ chrome/browser/autofill/phone_number_i18n.cc (working copy) |
| @@ -10,7 +10,8 @@ |
| #include "base/string_number_conversions.h" |
| #include "base/utf_string_conversions.h" |
| #include "chrome/browser/autofill/autofill_country.h" |
| -#include "third_party/libphonenumber/cpp/src/phonenumberutil.h" |
| +#define USE_GOOGLE_BASE |
| +#include "third_party/libphonenumber/src/phonenumbers/phonenumberutil.h" |
|
Ilya Sherman
2011/11/29 22:36:31
Hmm, I don't like that every Chromium client would
GeorgeY
2011/11/29 23:58:45
Done.
|
| using i18n::phonenumbers::PhoneNumber; |
| using i18n::phonenumbers::PhoneNumberUtil; |
| @@ -108,7 +109,7 @@ |
| *city_code = UTF8ToUTF16(area_code); |
| *country_code = string16(); |
| - PhoneNumberUtil::NormalizeDigitsOnly(&number_text); |
| + phone_util->NormalizeDigitsOnly(&number_text); |
| string16 normalized_number(UTF8ToUTF16(number_text)); |
| // Check if parsed number has country code and it was not inferred from the |
| // locale. |
| @@ -148,7 +149,7 @@ |
| return string16(); |
| } |
| std::string result_utf8(UTF16ToUTF8(result)); |
| - PhoneNumberUtil::NormalizeDigitsOnly(&result_utf8); |
| + PhoneNumberUtil::GetInstance()->NormalizeDigitsOnly(&result_utf8); |
| return UTF8ToUTF16(result_utf8); |
| } |
| @@ -176,8 +177,10 @@ |
| std::string normalized_number(UTF16ToUTF8(city_code)); |
| normalized_number.append(UTF16ToUTF8(number)); |
| - PhoneNumberUtil::NormalizeDigitsOnly(&normalized_number); |
| + PhoneNumberUtil* phone_util = PhoneNumberUtil::GetInstance(); |
| + phone_util->NormalizeDigitsOnly(&normalized_number); |
| + |
| int64 number_int = 0; |
| if (!base::StringToInt64(normalized_number, &number_int) || !number_int) |
| return false; |
| @@ -185,8 +188,6 @@ |
| PhoneNumber i18n_number; |
| i18n_number.set_national_number(static_cast<uint64>(number_int)); |
| - PhoneNumberUtil* phone_util = PhoneNumberUtil::GetInstance(); |
| - |
| int country_int = phone_util->GetCountryCodeForRegion( |
| SanitizeLocaleCode(locale)); |
| if (!country_code.empty() && !base::StringToInt(country_code, &country_int)) |