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

Unified Diff: components/autofill/browser/autofill_country.cc

Issue 13488009: Remove application locale cache in autofill code. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 7 years, 8 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
Index: components/autofill/browser/autofill_country.cc
===================================================================
--- components/autofill/browser/autofill_country.cc (revision 192613)
+++ components/autofill/browser/autofill_country.cc (working copy)
@@ -16,8 +16,6 @@
#include "base/string_util.h"
#include "base/threading/thread_checker.h"
#include "base/utf_string_conversions.h"
-#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/content_browser_client.h"
#include "grit/generated_resources.h"
#include "third_party/icu/public/common/unicode/locid.h"
#include "third_party/icu/public/common/unicode/uloc.h"
@@ -28,8 +26,6 @@
#include "third_party/icu/public/i18n/unicode/ucol.h"
#include "ui/base/l10n/l10n_util.h"
-using content::BrowserThread;
-
namespace {
// The maximum capacity needed to store a locale up to the country code.
@@ -845,9 +841,6 @@
public:
static CountryNames* GetInstance();
- // Returns the application locale.
- const std::string ApplicationLocale();
-
// Returns the country code corresponding to |country|, which should be a
// country code or country name localized to |locale|.
const std::string GetCountryCode(const string16& country,
@@ -899,9 +892,6 @@
// Verifies thread-safety of accesses to the application locale.
base::ThreadChecker thread_checker_;
- // Caches the application locale, for thread-safe access.
- std::string application_locale_;
-
DISALLOW_COPY_AND_ASSIGN(CountryNames);
};
@@ -910,22 +900,6 @@
return Singleton<CountryNames>::get();
}
-const std::string CountryNames::ApplicationLocale() {
- if (application_locale_.empty()) {
- // In production code, this class is always constructed on the UI thread, so
- // the two conditions in the below DCHECK are identical. In test code,
- // sometimes there is a UI thread, and sometimes there is just the unnamed
- // main thread. Since this class is a singleton, it needs to support both
- // cases. Hence, the somewhat strange looking DCHECK below.
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
- thread_checker_.CalledOnValidThread());
- application_locale_ =
- content::GetContentClient()->browser()->GetApplicationLocale();
- }
-
- return application_locale_;
-}
-
CountryNames::CountryNames() {
// Add 2- and 3-letter ISO country codes.
for (CountryDataMap::Iterator it = CountryDataMap::Begin();
@@ -1126,11 +1100,6 @@
return CountryNames::GetInstance()->GetCountryCode(country, locale);
}
-// static
-const std::string AutofillCountry::ApplicationLocale() {
- return CountryNames::GetInstance()->ApplicationLocale();
-}
-
AutofillCountry::AutofillCountry(const std::string& country_code,
const string16& name,
const string16& postal_code_label,
« no previous file with comments | « components/autofill/browser/autofill_country.h ('k') | components/autofill/browser/autofill_ie_toolbar_import_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698