Skip to content

Commit 6e0302b

Browse files
committed
Fix navigator.language in single process mode.
1 parent 6ae0f4b commit 6e0302b

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/shell_content_browser_client.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,20 @@
2020

2121
#include "content/nw/src/shell_content_browser_client.h"
2222

23-
#include "base/command_line.h"
2423
#include "base/file_path.h"
2524
#include "base/file_util.h"
2625
#include "base/threading/thread_restrictions.h"
27-
#include "content/public/common/content_switches.h"
2826
#include "content/public/browser/browser_url_handler.h"
2927
#include "content/public/browser/render_process_host.h"
3028
#include "content/public/browser/resource_dispatcher_host.h"
3129
#include "content/nw/src/browser/shell_devtools_delegate.h"
3230
#include "content/nw/src/browser/shell_resource_dispatcher_host_delegate.h"
33-
#include "content/nw/src/common/shell_switches.h"
3431
#include "content/nw/src/media/media_internals.h"
3532
#include "content/nw/src/shell.h"
3633
#include "content/nw/src/shell_browser_context.h"
3734
#include "content/nw/src/shell_browser_main_parts.h"
3835
#include "geolocation/shell_access_token_store.h"
3936
#include "googleurl/src/gurl.h"
40-
#include "ui/base/l10n/l10n_util.h"
4137

4238
namespace content {
4339

@@ -60,10 +56,6 @@ void ShellContentBrowserClient::RenderProcessHostCreated(
6056
render_process_id_ = host->GetID();
6157
}
6258

63-
std::string ShellContentBrowserClient::GetApplicationLocale() {
64-
return l10n_util::GetApplicationLocale("en-US");
65-
}
66-
6759
void ShellContentBrowserClient::ResourceDispatcherHostCreated() {
6860
resource_dispatcher_host_delegate_.reset(
6961
new ShellResourceDispatcherHostDelegate());

src/shell_content_browser_client.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class ShellContentBrowserClient : public ContentBrowserClient {
2727
virtual BrowserMainParts* CreateBrowserMainParts(
2828
const MainFunctionParams& parameters) OVERRIDE;
2929
virtual void RenderProcessHostCreated(RenderProcessHost* host) OVERRIDE;
30-
virtual std::string GetApplicationLocale() OVERRIDE;
3130
virtual void ResourceDispatcherHostCreated() OVERRIDE;
3231
virtual AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
3332
virtual std::string GetDefaultDownloadName() OVERRIDE;

src/shell_main_delegate.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@
3434
#include "content/nw/src/shell_browser_main.h"
3535
#include "content/nw/src/shell_content_browser_client.h"
3636
#include "third_party/node/src/node_version.h"
37+
#include "ui/base/l10n/l10n_util.h"
3738
#include "ui/base/resource/resource_bundle.h"
3839
#include "ui/base/ui_base_paths.h"
40+
#include "ui/base/ui_base_switches.h"
3941

4042
#include <stdio.h>
4143

@@ -105,6 +107,10 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
105107
// Enforce single process
106108
command_line->AppendSwitch(switches::kSingleProcess);
107109

110+
// Fix navigator.language in single process mode
111+
std::string locale = l10n_util::GetApplicationLocale("en-US");
112+
command_line->AppendSwitchASCII(switches::kLang, locale);
113+
108114
InitLogging();
109115

110116
SetContentClient(&content_client_);

0 commit comments

Comments
 (0)