|
@@ -82,6 +82,7 @@
|
|
|
#include "shell/common/gin_converters/value_converter.h"
|
|
|
#include "shell/common/gin_helper/dictionary.h"
|
|
|
#include "shell/common/gin_helper/object_template_builder.h"
|
|
|
+#include "shell/common/language_util.h"
|
|
|
#include "shell/common/mouse_util.h"
|
|
|
#include "shell/common/node_includes.h"
|
|
|
#include "shell/common/options_switches.h"
|
|
@@ -91,6 +92,8 @@
|
|
|
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
|
|
|
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
|
|
|
#include "third_party/blink/public/mojom/frame/fullscreen.mojom.h"
|
|
|
+#include "third_party/blink/public/mojom/messaging/transferable_message.mojom.h"
|
|
|
+#include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
|
|
|
#include "ui/base/cursor/cursor.h"
|
|
|
#include "ui/base/mojom/cursor_type.mojom-shared.h"
|
|
|
#include "ui/display/screen.h"
|
|
@@ -112,7 +115,6 @@
|
|
|
#endif
|
|
|
|
|
|
#if defined(OS_LINUX) || defined(OS_WIN)
|
|
|
-#include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
|
|
|
#include "ui/gfx/font_render_params.h"
|
|
|
#endif
|
|
|
|
|
@@ -526,7 +528,22 @@ void WebContents::InitWithSessionAndOptions(
|
|
|
managed_web_contents()->GetView()->SetDelegate(this);
|
|
|
|
|
|
auto* prefs = web_contents()->GetMutableRendererPrefs();
|
|
|
- prefs->accept_languages = g_browser_process->GetApplicationLocale();
|
|
|
+
|
|
|
+ // Collect preferred languages from OS and browser process. accept_languages
|
|
|
+ // effects HTTP header, navigator.languages, and CJK fallback font selection.
|
|
|
+ //
|
|
|
+ // Note that an application locale set to the browser process might be
|
|
|
+ // different with the one set to the preference list.
|
|
|
+ // (e.g. overridden with --lang)
|
|
|
+ std::string accept_languages =
|
|
|
+ g_browser_process->GetApplicationLocale() + ",";
|
|
|
+ for (auto const& language : electron::GetPreferredLanguages()) {
|
|
|
+ if (language == g_browser_process->GetApplicationLocale())
|
|
|
+ continue;
|
|
|
+ accept_languages += language + ",";
|
|
|
+ }
|
|
|
+ accept_languages.pop_back();
|
|
|
+ prefs->accept_languages = accept_languages;
|
|
|
|
|
|
#if defined(OS_LINUX) || defined(OS_WIN)
|
|
|
// Update font settings.
|