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/trunk@875 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2012-10-22 20:56:38 +00:00
parent 21c2b1ecdd
commit e9c567599d
4 changed files with 8 additions and 9 deletions

View File

@ -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,

View File

@ -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";

View File

@ -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[];

View File

@ -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 <Objbase.h> // 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,