From 32341bc7eb5390180e0380fb548adfaa87961260 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 22 Oct 2012 20:56:56 +0000 Subject: [PATCH] Merge revision 875 changes: - Always set "lang" command-line flag, and use instead of "locale", to avoid an assertion in RenderThreadImpl::GetLocale() (issue #759). git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1271@876 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- cef3/libcef/browser/content_browser_client.cc | 3 ++- cef3/libcef/common/cef_switches.cc | 3 --- cef3/libcef/common/cef_switches.h | 1 - cef3/libcef/common/main_delegate.cc | 10 ++++++---- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cef3/libcef/browser/content_browser_client.cc b/cef3/libcef/browser/content_browser_client.cc index 77b3666fa..c4003d404 100644 --- a/cef3/libcef/browser/content_browser_client.cc +++ b/cef3/libcef/browser/content_browser_client.cc @@ -32,6 +32,7 @@ #include "content/public/browser/resource_dispatcher_host.h" #include "content/public/common/content_switches.h" #include "googleurl/src/gurl.h" +#include "ui/base/ui_base_switches.h" namespace { @@ -273,7 +274,7 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches( // any associated values) if present in the browser command line. static const char* const kSwitchNames[] = { switches::kProductVersion, - switches::kLocale, + switches::kLang, switches::kResourcesDirPath, switches::kLocalesDirPath, switches::kPackLoadingDisabled, diff --git a/cef3/libcef/common/cef_switches.cc b/cef3/libcef/common/cef_switches.cc index e5c42ef39..8396a6a1d 100644 --- a/cef3/libcef/common/cef_switches.cc +++ b/cef3/libcef/common/cef_switches.cc @@ -9,9 +9,6 @@ namespace switches { // Product version string. const char kProductVersion[] = "product-version"; -// Locale string. -const char kLocale[] = "locale"; - // Log file path. const char kLogFile[] = "log-file"; diff --git a/cef3/libcef/common/cef_switches.h b/cef3/libcef/common/cef_switches.h index c46d8a142..a486b5518 100644 --- a/cef3/libcef/common/cef_switches.h +++ b/cef3/libcef/common/cef_switches.h @@ -11,7 +11,6 @@ namespace switches { extern const char kProductVersion[]; -extern const char kLocale[]; extern const char kLogFile[]; extern const char kLogSeverity[]; extern const char kLogSeverity_Verbose[]; diff --git a/cef3/libcef/common/main_delegate.cc b/cef3/libcef/common/main_delegate.cc index 5bbe0953f..458dc43e6 100644 --- a/cef3/libcef/common/main_delegate.cc +++ b/cef3/libcef/common/main_delegate.cc @@ -23,6 +23,7 @@ #include "content/public/common/main_function_params.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" +#include "ui/base/ui_base_switches.h" #if defined(OS_WIN) #include // NOLINT(build/include_order) @@ -182,8 +183,10 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) { } if (settings.locale.length > 0) { - command_line->AppendSwitchASCII(switches::kLocale, + command_line->AppendSwitchASCII(switches::kLang, CefString(&settings.locale)); + } else if (!command_line->HasSwitch(switches::kLang)) { + command_line->AppendSwitchASCII(switches::kLang, "en-US"); } if (settings.log_file.length > 0) { @@ -409,9 +412,8 @@ void CefMainDelegate::InitializeResourceBundle() { PathService::Override(ui::DIR_LOCALES, locales_dir); } - std::string locale = command_line.GetSwitchValueASCII(switches::kLocale); - if (locale.empty()) - locale = "en-US"; + std::string locale = command_line.GetSwitchValueASCII(switches::kLang); + DCHECK(!locale.empty()); const std::string loaded_locale = ui::ResourceBundle::InitSharedInstanceWithLocale(locale,