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

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

Issue 8355025: Fix an Autofill crash caused by accessing the g_browser_process on the DB thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix more tests? Created 9 years, 2 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.h ('k') | chrome/browser/autofill/phone_number_i18n.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/autofill/phone_number.cc
diff --git a/chrome/browser/autofill/phone_number.cc b/chrome/browser/autofill/phone_number.cc
index cf0545ca0cf921f5489b74233e01413eabd07b55..4c78cc427a31f787bbaf1a763b24ad45da3b12a4 100644
--- a/chrome/browser/autofill/phone_number.cc
+++ b/chrome/browser/autofill/phone_number.cc
@@ -94,7 +94,7 @@ void PhoneNumber::SetInfo(AutofillFieldType type, const string16& value) {
}
number_ = value;
- cached_parsed_phone_ = autofill_i18n::PhoneObject(number_, locale());
+ cached_parsed_phone_ = autofill_i18n::PhoneObject(number_, GetLocale());
}
// Normalize phones if |type| is a whole number:
@@ -107,7 +107,7 @@ string16 PhoneNumber::GetCanonicalizedInfo(AutofillFieldType type) const {
return phone;
string16 normalized_phone = autofill_i18n::NormalizePhoneNumber(phone,
- locale());
+ GetLocale());
if (!normalized_phone.empty())
return normalized_phone;
@@ -132,7 +132,7 @@ void PhoneNumber::GetMatchingTypes(const string16& text,
// For US numbers, also compare to the three-digit prefix and the four-digit
// suffix, since web sites often split numbers into these two fields.
string16 number = GetCanonicalizedInfo(PHONE_HOME_NUMBER);
- if (locale() == "US" && number.size() == (kPrefixLength + kSuffixLength)) {
+ if (GetLocale() == "US" && number.size() == (kPrefixLength + kSuffixLength)) {
string16 prefix = number.substr(kPrefixOffset, kPrefixLength);
string16 suffix = number.substr(kSuffixOffset, kSuffixLength);
if (text == prefix || text == suffix)
@@ -141,7 +141,7 @@ void PhoneNumber::GetMatchingTypes(const string16& text,
string16 whole_number = GetCanonicalizedInfo(PHONE_HOME_WHOLE_NUMBER);
if (!whole_number.empty() &&
- autofill_i18n::NormalizePhoneNumber(text, locale()) == whole_number) {
+ autofill_i18n::NormalizePhoneNumber(text, GetLocale()) == whole_number) {
matching_types->insert(PHONE_HOME_WHOLE_NUMBER);
}
}
@@ -156,7 +156,7 @@ bool PhoneNumber::NormalizePhone() {
return !number_.empty();
}
-std::string PhoneNumber::locale() const {
+std::string PhoneNumber::GetLocale() const {
if (!profile_) {
NOTREACHED();
return "US";
@@ -166,8 +166,9 @@ std::string PhoneNumber::locale() const {
}
void PhoneNumber::UpdateCacheIfNeeded() const {
- if (!number_.empty() && cached_parsed_phone_.GetLocale() != locale())
- cached_parsed_phone_ = autofill_i18n::PhoneObject(number_, locale());
+ std::string locale = GetLocale();
+ if (!number_.empty() && cached_parsed_phone_.GetLocale() != locale)
+ cached_parsed_phone_ = autofill_i18n::PhoneObject(number_, locale);
}
PhoneNumber::PhoneCombineHelper::PhoneCombineHelper() {
« no previous file with comments | « chrome/browser/autofill/phone_number.h ('k') | chrome/browser/autofill/phone_number_i18n.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698