зеркало из https://github.com/electron/electron.git
Support for navigator.languages (#12419)
This commit is contained in:
Родитель
171230e45d
Коммит
fbff355742
|
@ -50,6 +50,7 @@
|
|||
#include "base/values.h"
|
||||
#include "brightray/browser/inspectable_web_contents.h"
|
||||
#include "brightray/browser/inspectable_web_contents_view.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/printing/print_preview_message_handler.h"
|
||||
#include "chrome/browser/printing/print_view_manager_basic.h"
|
||||
#include "chrome/browser/ssl/security_state_tab_helper.h"
|
||||
|
@ -102,7 +103,6 @@ struct PrintSettings {
|
|||
bool print_background;
|
||||
base::string16 device_name;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace mate {
|
||||
|
@ -437,9 +437,11 @@ void WebContents::InitWithSessionAndOptions(v8::Isolate* isolate,
|
|||
|
||||
managed_web_contents()->GetView()->SetDelegate(this);
|
||||
|
||||
auto* prefs = web_contents->GetMutableRendererPrefs();
|
||||
prefs->accept_languages = g_browser_process->GetApplicationLocale();
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_WIN)
|
||||
// Update font settings.
|
||||
auto* prefs = web_contents->GetMutableRendererPrefs();
|
||||
CR_DEFINE_STATIC_LOCAL(const gfx::FontRenderParams, params,
|
||||
(gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr)));
|
||||
prefs->should_antialias_text = params.antialiasing;
|
||||
|
|
|
@ -132,6 +132,14 @@ describe('chromium feature', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('navigator.languages', (done) => {
|
||||
it('should return the system locale only', () => {
|
||||
let appLocale = app.getLocale()
|
||||
assert.equal(navigator.languages.length, 1)
|
||||
assert.equal(navigator.languages[0], appLocale)
|
||||
})
|
||||
})
|
||||
|
||||
describe('navigator.serviceWorker', () => {
|
||||
it('should register for file scheme', (done) => {
|
||||
w = new BrowserWindow({
|
||||
|
|
Загрузка…
Ссылка в новой задаче