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

Unified Diff: chrome/browser/autofill/phone_number_i18n.cc

Issue 11529004: [Autofill] Style cleanup in phone number-related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autofill/phone_number_i18n.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/browser/autofill/phone_number_i18n.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698