From c6e03f83905b6784619bc5db8404fe75df1dc4e2 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 7 Jan 2016 12:17:19 +0800 Subject: [PATCH 1/5] Remove overlayScrollbars and sharedWorker options They are already enabled by default. --- atom/browser/web_contents_preferences.cc | 4 ---- atom/common/options_switches.cc | 4 ---- atom/common/options_switches.h | 4 ---- atom/renderer/atom_renderer_client.cc | 4 ---- docs/api/browser-window.md | 3 --- 5 files changed, 19 deletions(-) diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index 382c28951dba..0c2055126adc 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -34,10 +34,6 @@ FeaturePair kWebRuntimeFeatures[] = { switches::kExperimentalFeatures }, { options::kExperimentalCanvasFeatures, switches::kExperimentalCanvasFeatures }, - { options::kOverlayScrollbars, - switches::kOverlayScrollbars }, - { options::kSharedWorker, - switches::kSharedWorker }, { options::kPageVisibility, switches::kPageVisibility }, }; diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index 6a3490f41d42..b87f10a83a0c 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -97,8 +97,6 @@ const char kOpenerID[] = "openerId"; // Web runtime features. const char kExperimentalFeatures[] = "experimentalFeatures"; const char kExperimentalCanvasFeatures[] = "experimentalCanvasFeatures"; -const char kOverlayScrollbars[] = "overlayScrollbars"; -const char kSharedWorker[] = "sharedWorker"; } // namespace options @@ -143,8 +141,6 @@ const char kNodeIntegration[] = "node-integration"; const char kGuestInstanceID[] = "guest-instance-id"; const char kExperimentalFeatures[] = "experimental-features"; const char kExperimentalCanvasFeatures[] = "experimental-canvas-features"; -const char kOverlayScrollbars[] = "overlay-scrollbars"; -const char kSharedWorker[] = "shared-worker"; const char kPageVisibility[] = "page-visiblity"; const char kOpenerID[] = "opener-id"; diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index 161244450a12..7052acb048bf 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -49,8 +49,6 @@ extern const char kNodeIntegration[]; extern const char kGuestInstanceID[]; extern const char kExperimentalFeatures[]; extern const char kExperimentalCanvasFeatures[]; -extern const char kOverlayScrollbars[]; -extern const char kSharedWorker[]; extern const char kPageVisibility[]; extern const char kOpenerID[]; @@ -79,8 +77,6 @@ extern const char kNodeIntegration[]; extern const char kGuestInstanceID[]; extern const char kExperimentalFeatures[]; extern const char kExperimentalCanvasFeatures[]; -extern const char kOverlayScrollbars[]; -extern const char kSharedWorker[]; extern const char kPageVisibility[]; extern const char kOpenerID[]; diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index 6abe839b83f6..bae49bf9f176 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -230,10 +230,6 @@ void AtomRendererClient::EnableWebRuntimeFeatures() { blink::WebRuntimeFeatures::enableExperimentalFeatures(true); if (IsSwitchEnabled(command_line, switches::kExperimentalCanvasFeatures)) blink::WebRuntimeFeatures::enableExperimentalCanvasFeatures(true); - if (IsSwitchEnabled(command_line, switches::kOverlayScrollbars)) - blink::WebRuntimeFeatures::enableOverlayScrollbars(true); - if (IsSwitchEnabled(command_line, switches::kSharedWorker)) - blink::WebRuntimeFeatures::enableSharedWorker(true); } void AtomRendererClient::AddKeySystems( diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 44c4da5c65b6..b6a46316aea1 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -136,9 +136,6 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. Default is `false`. * `experimentalCanvasFeatures` Boolean - Enables Chromium's experimental canvas features. Default is `false`. - * `overlayScrollbars` Boolean - Enables overlay scrollbars. Default is - `false`. - * `sharedWorker` Boolean - Enables Shared Worker support. Default is `false`. * `directWrite` Boolean - Enables DirectWrite font rendering system on Windows. Default is `true`. * `pageVisibility` Boolean - Page would be forced to be always in visible From 16d23bbda55059cbbcbb14f3ca995e4407c1cd8e Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 7 Jan 2016 12:28:20 +0800 Subject: [PATCH 2/5] Remove pageVisibility option The original purpose of this option is not working anymore, also adds docs on the current way to disable process backgrounding. --- atom/browser/web_contents_preferences.cc | 2 -- atom/common/options_switches.cc | 4 ---- atom/common/options_switches.h | 2 -- atom/renderer/atom_renderer_client.cc | 13 ------------- atom/renderer/atom_renderer_client.h | 3 --- docs/api/browser-window.md | 4 ---- docs/api/chrome-command-line-switches.md | 20 +++++++++++++++----- 7 files changed, 15 insertions(+), 33 deletions(-) diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index 0c2055126adc..92b89de614ed 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -34,8 +34,6 @@ FeaturePair kWebRuntimeFeatures[] = { switches::kExperimentalFeatures }, { options::kExperimentalCanvasFeatures, switches::kExperimentalCanvasFeatures }, - { options::kPageVisibility, - switches::kPageVisibility }, }; } // namespace diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index b87f10a83a0c..776113cb1011 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -85,9 +85,6 @@ const char kNodeIntegration[] = "nodeIntegration"; // Instancd ID of guest WebContents. const char kGuestInstanceID[] = "guestInstanceId"; -// Set page visiblity to always visible. -const char kPageVisibility[] = "pageVisibility"; - // Enable DirectWrite on Windows. const char kDirectWrite[] = "directWrite"; @@ -141,7 +138,6 @@ const char kNodeIntegration[] = "node-integration"; const char kGuestInstanceID[] = "guest-instance-id"; const char kExperimentalFeatures[] = "experimental-features"; const char kExperimentalCanvasFeatures[] = "experimental-canvas-features"; -const char kPageVisibility[] = "page-visiblity"; const char kOpenerID[] = "opener-id"; // Widevine options diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index 7052acb048bf..f22d35df1871 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -49,7 +49,6 @@ extern const char kNodeIntegration[]; extern const char kGuestInstanceID[]; extern const char kExperimentalFeatures[]; extern const char kExperimentalCanvasFeatures[]; -extern const char kPageVisibility[]; extern const char kOpenerID[]; } // namespace options @@ -77,7 +76,6 @@ extern const char kNodeIntegration[]; extern const char kGuestInstanceID[]; extern const char kExperimentalFeatures[]; extern const char kExperimentalCanvasFeatures[]; -extern const char kPageVisibility[]; extern const char kOpenerID[]; extern const char kWidevineCdmPath[]; diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index bae49bf9f176..31336f3bab47 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -210,19 +210,6 @@ content::BrowserPluginDelegate* AtomRendererClient::CreateBrowserPluginDelegate( } } -bool AtomRendererClient::ShouldOverridePageVisibilityState( - const content::RenderFrame* render_frame, - blink::WebPageVisibilityState* override_state) { - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - - if (IsSwitchEnabled(command_line, switches::kPageVisibility)) { - *override_state = blink::WebPageVisibilityStateVisible; - return true; - } - - return false; -} - void AtomRendererClient::EnableWebRuntimeFeatures() { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); diff --git a/atom/renderer/atom_renderer_client.h b/atom/renderer/atom_renderer_client.h index ee082e964c76..d99e83f79aa0 100644 --- a/atom/renderer/atom_renderer_client.h +++ b/atom/renderer/atom_renderer_client.h @@ -56,9 +56,6 @@ class AtomRendererClient : public content::ContentRendererClient, content::RenderFrame* render_frame, const std::string& mime_type, const GURL& original_url) override; - bool ShouldOverridePageVisibilityState( - const content::RenderFrame* render_frame, - blink::WebPageVisibilityState* override_state) override; void AddKeySystems(std::vector* key_systems) override; void EnableWebRuntimeFeatures(); diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index b6a46316aea1..6dc52576677a 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -138,10 +138,6 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. canvas features. Default is `false`. * `directWrite` Boolean - Enables DirectWrite font rendering system on Windows. Default is `true`. - * `pageVisibility` Boolean - Page would be forced to be always in visible - or hidden state once set, instead of reflecting current window's - visibility. Users can set it to `true` to prevent throttling of DOM - timers. Default is `false`. ## Events diff --git a/docs/api/chrome-command-line-switches.md b/docs/api/chrome-command-line-switches.md index 798d756820ad..65f096eac6e0 100644 --- a/docs/api/chrome-command-line-switches.md +++ b/docs/api/chrome-command-line-switches.md @@ -94,10 +94,6 @@ connection, and the endpoint host in a `SOCKS` proxy connection). Like `--host-rules` but these `rules` only apply to the host resolver. -[app]: app.md -[append-switch]: app.md#appcommandlineappendswitchswitch-value -[ready]: app.md#event-ready - ## --ignore-certificate-errors Ignores certificate related errors. @@ -121,7 +117,16 @@ fallback will accept. ## --cipher-suite-blacklist=`cipher_suites` -Specify comma-separated list of SSL cipher suites to disable. +Specifies comma-separated list of SSL cipher suites to disable. + +## --disable-renderer-backgrounding + +Prevents Chromium from lowering the priority of invisible pages' renderer +processes. + +This flag is global to all renderer processes, if you only want to disable +throttling in one window, you can take the hack of +[playing silent audio][play-silent-audio]. ## --enable-logging @@ -149,3 +154,8 @@ whole pathname and not just the module. E.g. `*/foo/bar/*=2` would change the logging level for all code in the source files under a `foo/bar` directory. This switch only works when `--enable-logging` is also passed. + +[app]: app.md +[append-switch]: app.md#appcommandlineappendswitchswitch-value +[ready]: app.md#event-ready +[play-silent-audio]: https://github.com/atom/atom/pull/9485/files From bd20b3f32a4e35e47a0c75f94b28612fc272462a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 7 Jan 2016 12:49:00 +0800 Subject: [PATCH 3/5] Rely on content switches for implementing experimental features --- atom/browser/web_contents_preferences.cc | 30 ++++++------------------ atom/common/options_switches.cc | 2 -- atom/common/options_switches.h | 2 -- atom/renderer/atom_renderer_client.cc | 16 ------------- atom/renderer/atom_renderer_client.h | 2 -- 5 files changed, 7 insertions(+), 45 deletions(-) diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index 92b89de614ed..03003a563a19 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -10,6 +10,7 @@ #include "atom/common/options_switches.h" #include "base/command_line.h" #include "base/strings/string_number_conversions.h" +#include "content/public/common/content_switches.h" #include "content/public/common/web_preferences.h" #include "native_mate/dictionary.h" #include "net/base/filename_util.h" @@ -22,22 +23,6 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(atom::WebContentsPreferences); namespace atom { -namespace { - -// Array of available web runtime features. -struct FeaturePair { - const char* name; - const char* cmd; -}; -FeaturePair kWebRuntimeFeatures[] = { - { options::kExperimentalFeatures, - switches::kExperimentalFeatures }, - { options::kExperimentalCanvasFeatures, - switches::kExperimentalCanvasFeatures }, -}; - -} // namespace - WebContentsPreferences::WebContentsPreferences( content::WebContents* web_contents, const mate::Dictionary& web_preferences) { @@ -79,13 +64,12 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches( if (web_preferences.GetBoolean("plugins", &b) && b) command_line->AppendSwitch(switches::kEnablePlugins); - // This set of options are not availabe in WebPreferences, so we have to pass - // them via command line and enable them in renderer procss. - for (size_t i = 0; i < arraysize(kWebRuntimeFeatures); ++i) { - const auto& feature = kWebRuntimeFeatures[i]; - if (web_preferences.GetBoolean(feature.name, &b)) - command_line->AppendSwitchASCII(feature.cmd, b ? "true" : "false"); - } + // Experimental flags. + if (web_preferences.GetBoolean(options::kExperimentalFeatures, &b) && b) + command_line->AppendSwitch( + ::switches::kEnableExperimentalWebPlatformFeatures); + if (web_preferences.GetBoolean(options::kExperimentalCanvasFeatures, &b) && b) + command_line->AppendSwitch(::switches::kEnableExperimentalCanvasFeatures); // Check if we have node integration specified. bool node_integration = true; diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index 776113cb1011..a62af41e16ca 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -136,8 +136,6 @@ const char kPreloadScript[] = "preload"; const char kPreloadURL[] = "preload-url"; const char kNodeIntegration[] = "node-integration"; const char kGuestInstanceID[] = "guest-instance-id"; -const char kExperimentalFeatures[] = "experimental-features"; -const char kExperimentalCanvasFeatures[] = "experimental-canvas-features"; const char kOpenerID[] = "opener-id"; // Widevine options diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index f22d35df1871..ef860b6aeacc 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -74,8 +74,6 @@ extern const char kPreloadScript[]; extern const char kPreloadURL[]; extern const char kNodeIntegration[]; extern const char kGuestInstanceID[]; -extern const char kExperimentalFeatures[]; -extern const char kExperimentalCanvasFeatures[]; extern const char kOpenerID[]; extern const char kWidevineCdmPath[]; diff --git a/atom/renderer/atom_renderer_client.cc b/atom/renderer/atom_renderer_client.cc index 31336f3bab47..d9c364c3733f 100644 --- a/atom/renderer/atom_renderer_client.cc +++ b/atom/renderer/atom_renderer_client.cc @@ -41,11 +41,6 @@ namespace atom { namespace { -bool IsSwitchEnabled(base::CommandLine* command_line, - const char* switch_string) { - return command_line->GetSwitchValueASCII(switch_string) == "true"; -} - // Helper class to forward the messages to the client. class AtomRenderFrameObserver : public content::RenderFrameObserver { public: @@ -95,8 +90,6 @@ AtomRendererClient::~AtomRendererClient() { } void AtomRendererClient::WebKitInitialized() { - EnableWebRuntimeFeatures(); - blink::WebCustomElement::addEmbedderCustomElementName("webview"); blink::WebCustomElement::addEmbedderCustomElementName("browserplugin"); @@ -210,15 +203,6 @@ content::BrowserPluginDelegate* AtomRendererClient::CreateBrowserPluginDelegate( } } -void AtomRendererClient::EnableWebRuntimeFeatures() { - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - - if (IsSwitchEnabled(command_line, switches::kExperimentalFeatures)) - blink::WebRuntimeFeatures::enableExperimentalFeatures(true); - if (IsSwitchEnabled(command_line, switches::kExperimentalCanvasFeatures)) - blink::WebRuntimeFeatures::enableExperimentalCanvasFeatures(true); -} - void AtomRendererClient::AddKeySystems( std::vector* key_systems) { AddChromeKeySystems(key_systems); diff --git a/atom/renderer/atom_renderer_client.h b/atom/renderer/atom_renderer_client.h index d99e83f79aa0..beeeb9d530b0 100644 --- a/atom/renderer/atom_renderer_client.h +++ b/atom/renderer/atom_renderer_client.h @@ -58,8 +58,6 @@ class AtomRendererClient : public content::ContentRendererClient, const GURL& original_url) override; void AddKeySystems(std::vector* key_systems) override; - void EnableWebRuntimeFeatures(); - scoped_ptr node_bindings_; scoped_ptr atom_bindings_; From 3f2b26ddb77685785e54fca77387009b44373645 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 7 Jan 2016 14:10:18 +0800 Subject: [PATCH 4/5] Add blinkFeatures option --- atom/browser/web_contents_preferences.cc | 6 ++++++ atom/common/options_switches.cc | 9 ++++++--- atom/common/options_switches.h | 1 + docs/api/browser-window.md | 6 ++++++ 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index 03003a563a19..c75b0daaff48 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -116,6 +116,12 @@ void WebContentsPreferences::AppendExtraCommandLineSwitches( if (web_preferences.GetInteger(options::kOpenerID, &opener_id)) command_line->AppendSwitchASCII(switches::kOpenerID, base::IntToString(opener_id)); + + // Enable blink features. + std::string blink_features; + if (web_preferences.GetString(options::kBlinkFeatures, &blink_features)) + command_line->AppendSwitchASCII(::switches::kEnableBlinkFeatures, + blink_features); } // static diff --git a/atom/common/options_switches.cc b/atom/common/options_switches.cc index a62af41e16ca..6c4e8477cc4a 100644 --- a/atom/common/options_switches.cc +++ b/atom/common/options_switches.cc @@ -88,13 +88,16 @@ const char kGuestInstanceID[] = "guestInstanceId"; // Enable DirectWrite on Windows. const char kDirectWrite[] = "directWrite"; -// Opener window's ID. -const char kOpenerID[] = "openerId"; - // Web runtime features. const char kExperimentalFeatures[] = "experimentalFeatures"; const char kExperimentalCanvasFeatures[] = "experimentalCanvasFeatures"; +// Opener window's ID. +const char kOpenerID[] = "openerId"; + +// Enable blink features. +const char kBlinkFeatures[] = "blinkFeatures"; + } // namespace options namespace switches { diff --git a/atom/common/options_switches.h b/atom/common/options_switches.h index ef860b6aeacc..f038521673a0 100644 --- a/atom/common/options_switches.h +++ b/atom/common/options_switches.h @@ -50,6 +50,7 @@ extern const char kGuestInstanceID[]; extern const char kExperimentalFeatures[]; extern const char kExperimentalCanvasFeatures[]; extern const char kOpenerID[]; +extern const char kBlinkFeatures[]; } // namespace options diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 6dc52576677a..8511ca7a5655 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -138,6 +138,10 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. canvas features. Default is `false`. * `directWrite` Boolean - Enables DirectWrite font rendering system on Windows. Default is `true`. + * `blinkFeatures` String - A list of feature strings separated by `,`, like + `CSSVariables,KeyboardEventKey`. The full list of supported feature strings + can be found in the [setFeatureEnabledFromString][blink-feature-string] + function. ## Events @@ -750,3 +754,5 @@ Returns whether the window is visible on all workspaces. * `ignore` Boolean Ignore all moused events that happened in the window. + +[blink-feature-string]: https://code.google.com/p/chromium/codesearch#chromium/src/out/Debug/gen/blink/platform/RuntimeEnabledFeatures.cpp&sq=package:chromium&type=cs&l=527 From c0e728ab6ae82468c36ae527c7381079b8d038ae Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 7 Jan 2016 14:23:21 +0800 Subject: [PATCH 5/5] docs: Orgnize the options of BrowserWindow --- docs/api/browser-window.md | 216 +++++++++++++++++++------------------ 1 file changed, 113 insertions(+), 103 deletions(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index 8511ca7a5655..8fb64b561224 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -31,117 +31,127 @@ It creates a new `BrowserWindow` with native properties as set by the `options`. ### `new BrowserWindow([options])` -`options` Object (optional), properties: +* `options` Object + * `width` Integer - Window's width in pixels. Default is `800`. + * `height` Integer - Window's height in pixels. Default is `600`. + * `x` Integer - Window's left offset from screen. Default is to center the + window. + * `y` Integer - Window's top offset from screen. Default is to center the + window. + * `useContentSize` Boolean - The `width` and `height` would be used as web + page's size, which means the actual window's size will include window + frame's size and be slightly larger. Default is `false`. + * `center` Boolean - Show window in the center of the screen. + * `minWidth` Integer - Window's minimum width. Default is `0`. + * `minHeight` Integer - Window's minimum height. Default is `0`. + * `maxWidth` Integer - Window's maximum width. Default is no limit. + * `maxHeight` Integer - Window's maximum height. Default is no limit. + * `resizable` Boolean - Whether window is resizable. Default is `true`. + * `alwaysOnTop` Boolean - Whether the window should always stay on top of + other windows. Default is `false`. + * `fullscreen` Boolean - Whether the window should show in fullscreen. When + set to `false` the fullscreen button will be hidden or disabled on OS X. + Default is `false`. + * `skipTaskbar` Boolean - Whether to show the window in taskbar. Default is + `false`. + * `kiosk` Boolean - The kiosk mode. Default is `false`. + * `title` String - Default window title. Default is `"Electron"`. + * `icon` [NativeImage](native-image.md) - The window icon, when omitted on + Windows the executable's icon would be used as window icon. + * `show` Boolean - Whether window should be shown when created. Default is + `true`. + * `frame` Boolean - Specify `false` to create a + [Frameless Window](frameless-window.md). Default is `true`. + * `acceptFirstMouse` Boolean - Whether the web view accepts a single + mouse-down event that simultaneously activates the window. Default is `false`. + * `disableAutoHideCursor` Boolean - Whether to hide cursor when typing. Default + is `false`. + * `autoHideMenuBar` Boolean - Auto hide the menu bar unless the `Alt` + key is pressed. Default is `false`. + * `enableLargerThanScreen` Boolean - Enable the window to be resized larger + than screen. Default is `false`. + * `backgroundColor` String - Window's background color as Hexadecimal value, + like `#66CD00` or `#FFF`. This is only implemented on Linux and Windows. + Default is `#000` (black). + * `darkTheme` Boolean - Forces using dark theme for the window, only works on + some GTK+3 desktop environments. Default is `false`. + * `transparent` Boolean - Makes the window [transparent](frameless-window.md). + Default is `false`. + * `type` String - The type of window, default is normal window. See more about + this bellow. + * `titleBarStyle` String - The style of window title bar. See more about this + bellow. + * `webPreferences` Object - Settings of web page's features. See more about + this bellow. -* `width` Integer - Window's width in pixels. Default is `800`. -* `height` Integer - Window's height in pixels. Default is `600`. -* `x` Integer - Window's left offset from screen. Default is to center the - window. -* `y` Integer - Window's top offset from screen. Default is to center the - window. -* `useContentSize` Boolean - The `width` and `height` would be used as web - page's size, which means the actual window's size will include window - frame's size and be slightly larger. Default is `false`. -* `center` Boolean - Show window in the center of the screen. -* `minWidth` Integer - Window's minimum width. Default is `0`. -* `minHeight` Integer - Window's minimum height. Default is `0`. -* `maxWidth` Integer - Window's maximum width. Default is no limit. -* `maxHeight` Integer - Window's maximum height. Default is no limit. -* `resizable` Boolean - Whether window is resizable. Default is `true`. -* `alwaysOnTop` Boolean - Whether the window should always stay on top of - other windows. Default is `false`. -* `fullscreen` Boolean - Whether the window should show in fullscreen. When - set to `false` the fullscreen button will be hidden or disabled on OS X. - Default is `false`. -* `skipTaskbar` Boolean - Whether to show the window in taskbar. Default is - `false`. -* `kiosk` Boolean - The kiosk mode. Default is `false`. -* `title` String - Default window title. Default is `"Electron"`. -* `icon` [NativeImage](native-image.md) - The window icon, when omitted on - Windows the executable's icon would be used as window icon. -* `show` Boolean - Whether window should be shown when created. Default is - `true`. -* `frame` Boolean - Specify `false` to create a - [Frameless Window](frameless-window.md). Default is `true`. -* `acceptFirstMouse` Boolean - Whether the web view accepts a single - mouse-down event that simultaneously activates the window. Default is `false`. -* `disableAutoHideCursor` Boolean - Whether to hide cursor when typing. Default - is `false`. -* `autoHideMenuBar` Boolean - Auto hide the menu bar unless the `Alt` - key is pressed. Default is `false`. -* `enableLargerThanScreen` Boolean - Enable the window to be resized larger - than screen. Default is `false`. -* `backgroundColor` String - Window's background color as Hexadecimal value, - like `#66CD00` or `#FFF`. This is only implemented on Linux and Windows. - Default is `#000` (black). -* `darkTheme` Boolean - Forces using dark theme for the window, only works on - some GTK+3 desktop environments. Default is `false`. -* `transparent` Boolean - Makes the window [transparent](frameless-window.md). - Default is `false`. -* `type` String - Specifies the type of the window, which applies - additional platform-specific properties. By default it's undefined and you'll - get a regular app window. Supported values: - * On Linux, possible types are `desktop`, `dock`, `toolbar`, `splash`, - `notification`. - * On OS X, possible types are `desktop`, `textured`. The `textured` type adds - metal gradient appearance (`NSTexturedBackgroundWindowMask`). The `desktop` - type places the window at the desktop background window level +The possible values and behaviors of `type` option are platform dependent, +supported values are: + +* On Linux, possible types are `desktop`, `dock`, `toolbar`, `splash`, + `notification`. +* On OS X, possible types are `desktop`, `textured`. + * The `textured` type adds metal gradient appearance + (`NSTexturedBackgroundWindowMask`). + * The `desktop` type places the window at the desktop background window level (`kCGDesktopWindowLevel - 1`). Note that desktop window will not receive focus, keyboard or mouse events, but you can use `globalShortcut` to receive input sparingly. -* `titleBarStyle` String, OS X - specifies the style of window title bar. - This option is supported on OS X 10.10 Yosemite and newer. There are three - possible values: - * `default` or not specified, results in the standard gray opaque Mac title + +The `titleBarStyle` option is only supported on OS X 10.10 Yosemite and newer. +Possible values are: + +* `default` or not specified, results in the standard gray opaque Mac title bar. - * `hidden` results in a hidden title bar and a full size content window, yet +* `hidden` results in a hidden title bar and a full size content window, yet the title bar still has the standard window controls ("traffic lights") in the top left. - * `hidden-inset` results in a hidden title bar with an alternative look +* `hidden-inset` results in a hidden title bar with an alternative look where the traffic light buttons are slightly more inset from the window edge. -* `webPreferences` Object - Settings of web page's features, properties: - * `nodeIntegration` Boolean - Whether node integration is enabled. Default - is `true`. - * `preload` String - Specifies a script that will be loaded before other - scripts run in the page. This script will always have access to node APIs - no matter whether node integration is turned on or off. The value should - be the absolute file path to the script. - When node integration is turned off, the preload script can reintroduce - Node global symbols back to the global scope. See example - [here](process.md#event-loaded). - * `partition` String - Sets the session used by the page. If `partition` - starts with `persist:`, the page will use a persistent session available to - all pages in the app with the same `partition`. if there is no `persist:` - prefix, the page will use an in-memory session. By assigning the same - `partition`, multiple pages can share the same session. If the `partition` - is unset then default session of the app will be used. - * `zoomFactor` Number - The default zoom factor of the page, `3.0` represents - `300%`. Default is `1.0`. - * `javascript` Boolean - Enables JavaScript support. Default is `true`. - * `webSecurity` Boolean - When setting `false`, it will disable the - same-origin policy (Usually using testing websites by people), and set - `allowDisplayingInsecureContent` and `allowRunningInsecureContent` to - `true` if these two options are not set by user. Default is `true`. - * `allowDisplayingInsecureContent` Boolean - Allow an https page to display - content like images from http URLs. Default is `false`. - * `allowRunningInsecureContent` Boolean - Allow a https page to run - JavaScript, CSS or plugins from http URLs. Default is `false`. - * `images` Boolean - Enables image support. Default is `true`. - * `textAreasAreResizable` Boolean - Make TextArea elements resizable. Default - is `true`. - * `webgl` Boolean - Enables WebGL support. Default is `true`. - * `webaudio` Boolean - Enables WebAudio support. Default is `true`. - * `plugins` Boolean - Whether plugins should be enabled. Default is `false`. - * `experimentalFeatures` Boolean - Enables Chromium's experimental features. - Default is `false`. - * `experimentalCanvasFeatures` Boolean - Enables Chromium's experimental - canvas features. Default is `false`. - * `directWrite` Boolean - Enables DirectWrite font rendering system on - Windows. Default is `true`. - * `blinkFeatures` String - A list of feature strings separated by `,`, like - `CSSVariables,KeyboardEventKey`. The full list of supported feature strings - can be found in the [setFeatureEnabledFromString][blink-feature-string] - function. + +The `webPreferences` option is an object that can have following properties: + +* `nodeIntegration` Boolean - Whether node integration is enabled. Default + is `true`. +* `preload` String - Specifies a script that will be loaded before other + scripts run in the page. This script will always have access to node APIs + no matter whether node integration is turned on or off. The value should + be the absolute file path to the script. + When node integration is turned off, the preload script can reintroduce + Node global symbols back to the global scope. See example + [here](process.md#event-loaded). +* `partition` String - Sets the session used by the page. If `partition` + starts with `persist:`, the page will use a persistent session available to + all pages in the app with the same `partition`. if there is no `persist:` + prefix, the page will use an in-memory session. By assigning the same + `partition`, multiple pages can share the same session. If the `partition` + is unset then default session of the app will be used. +* `zoomFactor` Number - The default zoom factor of the page, `3.0` represents + `300%`. Default is `1.0`. +* `javascript` Boolean - Enables JavaScript support. Default is `true`. +* `webSecurity` Boolean - When setting `false`, it will disable the + same-origin policy (Usually using testing websites by people), and set + `allowDisplayingInsecureContent` and `allowRunningInsecureContent` to + `true` if these two options are not set by user. Default is `true`. +* `allowDisplayingInsecureContent` Boolean - Allow an https page to display + content like images from http URLs. Default is `false`. +* `allowRunningInsecureContent` Boolean - Allow a https page to run + JavaScript, CSS or plugins from http URLs. Default is `false`. +* `images` Boolean - Enables image support. Default is `true`. +* `textAreasAreResizable` Boolean - Make TextArea elements resizable. Default + is `true`. +* `webgl` Boolean - Enables WebGL support. Default is `true`. +* `webaudio` Boolean - Enables WebAudio support. Default is `true`. +* `plugins` Boolean - Whether plugins should be enabled. Default is `false`. +* `experimentalFeatures` Boolean - Enables Chromium's experimental features. + Default is `false`. +* `experimentalCanvasFeatures` Boolean - Enables Chromium's experimental + canvas features. Default is `false`. +* `directWrite` Boolean - Enables DirectWrite font rendering system on + Windows. Default is `true`. +* `blinkFeatures` String - A list of feature strings separated by `,`, like + `CSSVariables,KeyboardEventKey`. The full list of supported feature strings + can be found in the [setFeatureEnabledFromString][blink-feature-string] + function. ## Events