| Index: chrome/browser/autofill/phone_number_i18n.cc
|
| diff --git a/chrome/browser/autofill/phone_number_i18n.cc b/chrome/browser/autofill/phone_number_i18n.cc
|
| index e8797c475f3a5a0d226e8685d94a5f239848267c..d3af5ad8cb28900932ae6286ff3b1fe02a4be33e 100644
|
| --- a/chrome/browser/autofill/phone_number_i18n.cc
|
| +++ b/chrome/browser/autofill/phone_number_i18n.cc
|
| @@ -25,21 +25,21 @@ std::string SanitizeRegion(const std::string& region) {
|
| AutofillCountry::ApplicationLocale());
|
| }
|
|
|
| -i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat UtilsTypeToPhoneLibType(
|
| +PhoneNumberUtil::PhoneNumberFormat UtilsTypeToPhoneLibType(
|
| autofill_i18n::FullPhoneFormat phone_format) {
|
| switch (phone_format) {
|
| case autofill_i18n::E164:
|
| - return i18n::phonenumbers::PhoneNumberUtil::E164;
|
| + return PhoneNumberUtil::E164;
|
| case autofill_i18n::INTERNATIONAL:
|
| - return i18n::phonenumbers::PhoneNumberUtil::INTERNATIONAL;
|
| + return PhoneNumberUtil::INTERNATIONAL;
|
| case autofill_i18n::NATIONAL:
|
| - return i18n::phonenumbers::PhoneNumberUtil::NATIONAL;
|
| + return PhoneNumberUtil::NATIONAL;
|
| case autofill_i18n::RFC3966:
|
| - return i18n::phonenumbers::PhoneNumberUtil::RFC3966;
|
| + return PhoneNumberUtil::RFC3966;
|
| default:
|
| NOTREACHED();
|
| + return PhoneNumberUtil::NATIONAL;
|
| }
|
| - return i18n::phonenumbers::PhoneNumberUtil::NATIONAL;
|
| }
|
|
|
| // Parses the number stored in |value| as it should be interpreted in the given
|
| @@ -51,14 +51,14 @@ bool ParsePhoneNumberInternal(const string16& value,
|
| string16* city_code,
|
| string16* number,
|
| PhoneNumber* i18n_number) {
|
| - DCHECK(number);
|
| - DCHECK(city_code);
|
| DCHECK(country_code);
|
| + DCHECK(city_code);
|
| + DCHECK(number);
|
| DCHECK(i18n_number);
|
|
|
| - number->clear();
|
| - city_code->clear();
|
| country_code->clear();
|
| + city_code->clear();
|
| + number->clear();
|
|
|
| std::string number_text(UTF16ToUTF8(value));
|
|
|
| @@ -68,13 +68,13 @@ bool ParsePhoneNumberInternal(const string16& value,
|
| // The |region| should already be sanitized.
|
| DCHECK_EQ(2U, region.size());
|
| if (phone_util->Parse(number_text, region.c_str(), i18n_number) !=
|
| - i18n::phonenumbers::PhoneNumberUtil::NO_PARSING_ERROR) {
|
| + PhoneNumberUtil::NO_PARSING_ERROR) {
|
| return false;
|
| }
|
|
|
| - i18n::phonenumbers::PhoneNumberUtil::ValidationResult validation =
|
| + PhoneNumberUtil::ValidationResult validation =
|
| phone_util->IsPossibleNumberWithReason(*i18n_number);
|
| - if (validation != i18n::phonenumbers::PhoneNumberUtil::IS_POSSIBLE)
|
| + if (validation != PhoneNumberUtil::IS_POSSIBLE)
|
| return false;
|
|
|
| // This verifies that number has a valid area code (that in some cases could
|
| @@ -157,10 +157,10 @@ bool ParsePhoneNumber(const string16& value,
|
| string16* country_code,
|
| string16* city_code,
|
| string16* number) {
|
| - PhoneNumber i18n_number;
|
| + PhoneNumber unused_i18n_number;
|
| return ParsePhoneNumberInternal(value, SanitizeRegion(region),
|
| country_code, city_code, number,
|
| - &i18n_number);
|
| + &unused_i18n_number);
|
| }
|
|
|
| bool ConstructPhoneNumber(const string16& country_code,
|
| @@ -194,9 +194,9 @@ bool ConstructPhoneNumber(const string16& country_code,
|
| if (country_int)
|
| i18n_number.set_country_code(country_int);
|
|
|
| - i18n::phonenumbers::PhoneNumberUtil::ValidationResult validation =
|
| + PhoneNumberUtil::ValidationResult validation =
|
| phone_util->IsPossibleNumberWithReason(i18n_number);
|
| - if (validation != i18n::phonenumbers::PhoneNumberUtil::IS_POSSIBLE)
|
| + if (validation != PhoneNumberUtil::IS_POSSIBLE)
|
| return false;
|
|
|
| // This verifies that number has a valid area code (that in some cases could
|
| @@ -224,30 +224,29 @@ bool PhoneNumbersMatch(const string16& number_a,
|
| // Parse phone numbers based on the region
|
| PhoneNumber i18n_number1;
|
| if (phone_util->Parse(UTF16ToUTF8(number_a), region.c_str(), &i18n_number1) !=
|
| - i18n::phonenumbers::PhoneNumberUtil::NO_PARSING_ERROR) {
|
| + PhoneNumberUtil::NO_PARSING_ERROR) {
|
| return false;
|
| }
|
|
|
| PhoneNumber i18n_number2;
|
| if (phone_util->Parse(UTF16ToUTF8(number_b), region.c_str(), &i18n_number2) !=
|
| - i18n::phonenumbers::PhoneNumberUtil::NO_PARSING_ERROR) {
|
| + PhoneNumberUtil::NO_PARSING_ERROR) {
|
| return false;
|
| }
|
|
|
| switch (phone_util->IsNumberMatch(i18n_number1, i18n_number2)) {
|
| - case i18n::phonenumbers::PhoneNumberUtil::INVALID_NUMBER:
|
| - case i18n::phonenumbers::PhoneNumberUtil::NO_MATCH:
|
| + case PhoneNumberUtil::INVALID_NUMBER:
|
| + case PhoneNumberUtil::NO_MATCH:
|
| return false;
|
| - case i18n::phonenumbers::PhoneNumberUtil::SHORT_NSN_MATCH:
|
| + case PhoneNumberUtil::SHORT_NSN_MATCH:
|
| return false;
|
| - case i18n::phonenumbers::PhoneNumberUtil::NSN_MATCH:
|
| - case i18n::phonenumbers::PhoneNumberUtil::EXACT_MATCH:
|
| + case PhoneNumberUtil::NSN_MATCH:
|
| + case PhoneNumberUtil::EXACT_MATCH:
|
| return true;
|
| default:
|
| NOTREACHED();
|
| + return false;
|
| }
|
| -
|
| - return false;
|
| }
|
|
|
| PhoneObject::PhoneObject(const string16& number, const std::string& region)
|
| @@ -283,10 +282,9 @@ PhoneObject::~PhoneObject() {
|
|
|
| string16 PhoneObject::GetWholeNumber() const {
|
| if (i18n_number_.get() && whole_number_.empty()) {
|
| - i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat format =
|
| - i18n::phonenumbers::PhoneNumberUtil::INTERNATIONAL;
|
| + PhoneNumberUtil::PhoneNumberFormat format = PhoneNumberUtil::INTERNATIONAL;
|
| if (country_code_.empty())
|
| - format = i18n::phonenumbers::PhoneNumberUtil::NATIONAL;
|
| + format = PhoneNumberUtil::NATIONAL;
|
|
|
| std::string formatted_number;
|
| PhoneNumberUtil* phone_util = PhoneNumberUtil::GetInstance();
|
|
|