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

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

Issue 6877130: These changes *are* for review :) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autofill/phone_number.cc ('k') | chrome/browser/autofill/phone_number_i18n_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/phone_number_i18n.cc
===================================================================
--- chrome/browser/autofill/phone_number_i18n.cc (revision 85791)
+++ chrome/browser/autofill/phone_number_i18n.cc (working copy)
@@ -10,14 +10,14 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "third_party/libphonenumber/cpp/src/phonenumberutil.h"
+#include "unicode/locid.h"
namespace {
std::string SanitizeLocaleCode(const std::string& locale_code) {
if (locale_code.length() == 2)
return locale_code;
- // Use USA for incomplete locales.
- return std::string("US");
+ return std::string(icu::Locale::getDefault().getCountry());
Ilya Sherman 2011/05/19 05:52:25 You might want to use AutofillCountry::Application
GeorgeY 2011/05/19 19:00:18 Done.
GeorgeY 2011/05/19 20:45:54 Changed before I looked up what it was actually do
Ilya Sherman 2011/05/19 20:57:47 Based on """ git gs 'SetDefault(' """ we never set
}
i18n::phonenumbers::PhoneNumberUtil::PhoneNumberFormat UtilsTypeToPhoneLibType(
@@ -162,6 +162,12 @@
if (validation != i18n::phonenumbers::PhoneNumberUtil::IS_POSSIBLE)
return false;
+ // This verifies that number has a valid area code (that in some cases could
+ // be empty) for parsed country code. Also verifies that this is a valid
+ // number (in US 1234567 is not valid, because numbers do not start with 1).
+ if (!phone_util->IsValidNumber(i18n_number))
+ return false;
+
std::string formatted_number;
phone_util->Format(i18n_number, UtilsTypeToPhoneLibType(phone_format),
« no previous file with comments | « chrome/browser/autofill/phone_number.cc ('k') | chrome/browser/autofill/phone_number_i18n_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698