diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-10 00:04:48 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-10 00:04:48 +0000 |
commit | ce4b6a9dbb6ac14810294205185d385f066457fc (patch) | |
tree | 6c152e7d0e6ffc89b5c80eadbab5f24ec6ed7424 /app/resource_bundle_win.cc | |
parent | a437e4c7a38a959f3412df30b9b066c5d869ccc4 (diff) | |
download | chromium_src-ce4b6a9dbb6ac14810294205185d385f066457fc.zip chromium_src-ce4b6a9dbb6ac14810294205185d385f066457fc.tar.gz chromium_src-ce4b6a9dbb6ac14810294205185d385f066457fc.tar.bz2 |
Make BrowserProcess::GetApplicationLocale thread safe and migrate
callers of l10n_util::GetApplicationLocale to use this instead.
In the browser process, it's wrong to call
l10n_util::GetApplicationLocale with an empty string because then
it won't consider the user pref value when resolving the locale.
On Linux, it's also wrong to call l10n_util::GetApplicationLocale
after startup because the call touches disk and on Linux, we assume
that all of the program files can be deleted after startup (so
updates in place can work).
Review URL: http://codereview.chromium.org/476002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34206 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/resource_bundle_win.cc')
-rw-r--r-- | app/resource_bundle_win.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/resource_bundle_win.cc b/app/resource_bundle_win.cc index 9a0f7eb..ae420b8 100644 --- a/app/resource_bundle_win.cc +++ b/app/resource_bundle_win.cc @@ -38,17 +38,18 @@ ResourceBundle::~ResourceBundle() { } } -void ResourceBundle::LoadResources(const std::wstring& pref_locale) { +std::string ResourceBundle::LoadResources(const std::wstring& pref_locale) { // As a convenience, set resources_data_ to the current resource module. resources_data_ = _AtlBaseModule.GetResourceInstance(); DCHECK(NULL == locale_resources_data_) << "locale dll already loaded"; - const FilePath& locale_path = GetLocaleFilePath(pref_locale); + std::string app_locale = l10n_util::GetApplicationLocale(pref_locale); + const FilePath& locale_path = GetLocaleFilePath(app_locale); if (locale_path.value().empty()) { // It's possible that there are no locale dlls found, in which case we just // return. NOTREACHED(); - return; + return std::string(); } // The dll should only have resources, not executable code. @@ -56,14 +57,14 @@ void ResourceBundle::LoadResources(const std::wstring& pref_locale) { GetDataDllLoadFlags()); DCHECK(locale_resources_data_ != NULL) << "unable to load generated resources"; + return app_locale; } // static -FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { +FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale) { FilePath locale_path; PathService::Get(app::DIR_LOCALES, &locale_path); - const std::string app_locale = l10n_util::GetApplicationLocale(pref_locale); if (app_locale.empty()) return FilePath(); |