commit
ace235b2fe
18 changed files with 197 additions and 51 deletions
|
@ -23,12 +23,13 @@
|
||||||
#include "atom/common/native_mate_converters/net_converter.h"
|
#include "atom/common/native_mate_converters/net_converter.h"
|
||||||
#include "atom/common/node_includes.h"
|
#include "atom/common/node_includes.h"
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
|
#include "base/guid.h"
|
||||||
#include "base/prefs/pref_service.h"
|
#include "base/prefs/pref_service.h"
|
||||||
#include "base/strings/string_number_conversions.h"
|
#include "base/strings/string_number_conversions.h"
|
||||||
#include "base/strings/string_util.h"
|
#include "base/strings/string_util.h"
|
||||||
#include "base/thread_task_runner_handle.h"
|
#include "base/thread_task_runner_handle.h"
|
||||||
#include "brightray/browser/net/devtools_network_conditions.h"
|
#include "brightray/browser/net/devtools_network_conditions.h"
|
||||||
#include "brightray/browser/net/devtools_network_controller.h"
|
#include "brightray/browser/net/devtools_network_controller_handle.h"
|
||||||
#include "chrome/common/pref_names.h"
|
#include "chrome/common/pref_names.h"
|
||||||
#include "content/public/browser/browser_thread.h"
|
#include "content/public/browser/browser_thread.h"
|
||||||
#include "content/public/browser/storage_partition.h"
|
#include "content/public/browser/storage_partition.h"
|
||||||
|
@ -288,7 +289,8 @@ void ClearHostResolverCacheInIO(
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Session::Session(AtomBrowserContext* browser_context)
|
Session::Session(AtomBrowserContext* browser_context)
|
||||||
: browser_context_(browser_context) {
|
: devtools_network_emulation_client_id_(base::GenerateGUID()),
|
||||||
|
browser_context_(browser_context) {
|
||||||
AttachAsUserData(browser_context);
|
AttachAsUserData(browser_context);
|
||||||
|
|
||||||
// Observe DownloadManger to get download notifications.
|
// Observe DownloadManger to get download notifications.
|
||||||
|
@ -381,25 +383,15 @@ void Session::EnableNetworkEmulation(const mate::Dictionary& options) {
|
||||||
download_throughput,
|
download_throughput,
|
||||||
upload_throughput));
|
upload_throughput));
|
||||||
}
|
}
|
||||||
auto controller = browser_context_->GetDevToolsNetworkController();
|
|
||||||
|
|
||||||
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
|
browser_context_->network_controller_handle()->SetNetworkState(
|
||||||
base::Bind(&brightray::DevToolsNetworkController::SetNetworkState,
|
devtools_network_emulation_client_id_, std::move(conditions));
|
||||||
base::Unretained(controller),
|
|
||||||
std::string(),
|
|
||||||
base::Passed(&conditions)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::DisableNetworkEmulation() {
|
void Session::DisableNetworkEmulation() {
|
||||||
scoped_ptr<brightray::DevToolsNetworkConditions> conditions(
|
scoped_ptr<brightray::DevToolsNetworkConditions> conditions;
|
||||||
new brightray::DevToolsNetworkConditions(false));
|
browser_context_->network_controller_handle()->SetNetworkState(
|
||||||
auto controller = browser_context_->GetDevToolsNetworkController();
|
devtools_network_emulation_client_id_, std::move(conditions));
|
||||||
|
|
||||||
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
|
|
||||||
base::Bind(&brightray::DevToolsNetworkController::SetNetworkState,
|
|
||||||
base::Unretained(controller),
|
|
||||||
std::string(),
|
|
||||||
base::Passed(&conditions)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::SetCertVerifyProc(v8::Local<v8::Value> val,
|
void Session::SetCertVerifyProc(v8::Local<v8::Value> val,
|
||||||
|
|
|
@ -86,6 +86,9 @@ class Session: public mate::TrackableObject<Session>,
|
||||||
v8::Global<v8::Value> cookies_;
|
v8::Global<v8::Value> cookies_;
|
||||||
v8::Global<v8::Value> web_request_;
|
v8::Global<v8::Value> web_request_;
|
||||||
|
|
||||||
|
// The X-DevTools-Emulate-Network-Conditions-Client-Id.
|
||||||
|
std::string devtools_network_emulation_client_id_;
|
||||||
|
|
||||||
scoped_refptr<AtomBrowserContext> browser_context_;
|
scoped_refptr<AtomBrowserContext> browser_context_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(Session);
|
DISALLOW_COPY_AND_ASSIGN(Session);
|
||||||
|
|
|
@ -217,6 +217,7 @@ content::ServiceWorkerContext* GetServiceWorkerContext(
|
||||||
|
|
||||||
WebContents::WebContents(content::WebContents* web_contents)
|
WebContents::WebContents(content::WebContents* web_contents)
|
||||||
: content::WebContentsObserver(web_contents),
|
: content::WebContentsObserver(web_contents),
|
||||||
|
embedder_(nullptr),
|
||||||
type_(REMOTE),
|
type_(REMOTE),
|
||||||
request_id_(0),
|
request_id_(0),
|
||||||
background_throttling_(true) {
|
background_throttling_(true) {
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
<key>CFBundleIconFile</key>
|
<key>CFBundleIconFile</key>
|
||||||
<string>electron.icns</string>
|
<string>electron.icns</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>0.37.5</string>
|
<string>0.37.6</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.37.5</string>
|
<string>0.37.6</string>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.developer-tools</string>
|
<string>public.app-category.developer-tools</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
|
|
@ -56,8 +56,8 @@ END
|
||||||
//
|
//
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
VS_VERSION_INFO VERSIONINFO
|
||||||
FILEVERSION 0,37,5,0
|
FILEVERSION 0,37,6,0
|
||||||
PRODUCTVERSION 0,37,5,0
|
PRODUCTVERSION 0,37,6,0
|
||||||
FILEFLAGSMASK 0x3fL
|
FILEFLAGSMASK 0x3fL
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
FILEFLAGS 0x1L
|
FILEFLAGS 0x1L
|
||||||
|
@ -74,12 +74,12 @@ BEGIN
|
||||||
BEGIN
|
BEGIN
|
||||||
VALUE "CompanyName", "GitHub, Inc."
|
VALUE "CompanyName", "GitHub, Inc."
|
||||||
VALUE "FileDescription", "Electron"
|
VALUE "FileDescription", "Electron"
|
||||||
VALUE "FileVersion", "0.37.5"
|
VALUE "FileVersion", "0.37.6"
|
||||||
VALUE "InternalName", "electron.exe"
|
VALUE "InternalName", "electron.exe"
|
||||||
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
|
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
|
||||||
VALUE "OriginalFilename", "electron.exe"
|
VALUE "OriginalFilename", "electron.exe"
|
||||||
VALUE "ProductName", "Electron"
|
VALUE "ProductName", "Electron"
|
||||||
VALUE "ProductVersion", "0.37.5"
|
VALUE "ProductVersion", "0.37.6"
|
||||||
VALUE "SquirrelAwareVersion", "1"
|
VALUE "SquirrelAwareVersion", "1"
|
||||||
END
|
END
|
||||||
END
|
END
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#define ATOM_MAJOR_VERSION 0
|
#define ATOM_MAJOR_VERSION 0
|
||||||
#define ATOM_MINOR_VERSION 37
|
#define ATOM_MINOR_VERSION 37
|
||||||
#define ATOM_PATCH_VERSION 5
|
#define ATOM_PATCH_VERSION 6
|
||||||
|
|
||||||
#define ATOM_VERSION_IS_RELEASE 1
|
#define ATOM_VERSION_IS_RELEASE 1
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ $ asar pack your-app app.asar
|
||||||
|
|
||||||
## Utilizando los paquetes `asar`
|
## Utilizando los paquetes `asar`
|
||||||
|
|
||||||
En Electron existen dos tipos de APIs: las APIs de Node, proveídas por Node.js,
|
En Electron existen dos tipos de APIs: las APIs de Node, provistas por Node.js,
|
||||||
y las APIs Web, proveídas por Chromium. Ambas APIs soportan la lecutra de paquetes `asar`.
|
y las APIs Web, provistas por Chromium. Ambas APIs soportan la lectura de paquetes `asar`.
|
||||||
|
|
||||||
### API Node
|
### API Node
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ $.get('file:///path/to/example.asar/file.txt', function(data) {
|
||||||
### Utilizando un paquete `asar` como un archivo normal
|
### Utilizando un paquete `asar` como un archivo normal
|
||||||
|
|
||||||
En algunas situaciones necesitaremos acceder al paquete `asar` como archivo, por ejemplo,
|
En algunas situaciones necesitaremos acceder al paquete `asar` como archivo, por ejemplo,
|
||||||
si necesitaramos verificar la integridad del archivo con un checksum.
|
si necesitáramos verificar la integridad del archivo con un checksum.
|
||||||
Para casos así es posible utilizar el módulo `original-fs`, que provee la API `fs` original:
|
Para casos así es posible utilizar el módulo `original-fs`, que provee la API `fs` original:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
@ -127,7 +127,7 @@ Las APIs que requieren el desempaquetamiento adicional son:
|
||||||
* `child_process.execFile`
|
* `child_process.execFile`
|
||||||
* `fs.open`
|
* `fs.open`
|
||||||
* `fs.openSync`
|
* `fs.openSync`
|
||||||
* `process.dlopen` - Utilizado po `require` en los módulos nativos
|
* `process.dlopen` - Utilizado por `require` en los módulos nativos
|
||||||
|
|
||||||
### Información falsa en `fs.stat`
|
### Información falsa en `fs.stat`
|
||||||
|
|
||||||
|
@ -143,8 +143,8 @@ Como se menciona arriba, algunas APIs de Node desempaquetarán archivos cuando e
|
||||||
que los referencie, además de los problemas de rendimiento que esto podría ocasionar, también
|
que los referencie, además de los problemas de rendimiento que esto podría ocasionar, también
|
||||||
podría accionar alertas falsas en software antivirus.
|
podría accionar alertas falsas en software antivirus.
|
||||||
|
|
||||||
Para lidiar con esto, puedes desempaquetar algunos archivos utilizando la opción `--unpack`,
|
Para lidiar con esto, puedes desempaquetar algunos archivos utilizando la opción `--unpack`.
|
||||||
a continuación un ejemplo que excluye las librerías compartidas de los módulos nativos:
|
A continuación, un ejemplo que excluye las librerías compartidas de los módulos nativos:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ asar pack app app.asar --unpack *.node
|
$ asar pack app app.asar --unpack *.node
|
||||||
|
|
|
@ -444,6 +444,9 @@ HTTP 요청을 보내기 전 요청 헤더를 사용할 수 있을 때 `listener
|
||||||
* `cancel` Boolean
|
* `cancel` Boolean
|
||||||
* `responseHeaders` Object (optional) - 이 속성이 제공되면 서버는 이 헤더와
|
* `responseHeaders` Object (optional) - 이 속성이 제공되면 서버는 이 헤더와
|
||||||
함께 응답합니다.
|
함께 응답합니다.
|
||||||
|
* `statusLine` String (optional) - `responseHeaders`를 덮어쓸 땐, 헤더의 상태를
|
||||||
|
변경하기 위해 반드시 지정되어야 합니다. 그렇지 않은 경우, 기존의 응답 헤더의 상태가
|
||||||
|
사용됩니다.
|
||||||
|
|
||||||
#### `ses.webRequest.onResponseStarted([filter, ]listener)`
|
#### `ses.webRequest.onResponseStarted([filter, ]listener)`
|
||||||
|
|
||||||
|
|
|
@ -39,9 +39,19 @@ C++ 코드는 많은 Chromium의 추상화와 타입을 사용합니다. 따라
|
||||||
* [Template literals](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Template_literals)
|
* [Template literals](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Template_literals)
|
||||||
는 `+`로 문자열을 합치는 대신 사용합니다.
|
는 `+`로 문자열을 합치는 대신 사용합니다.
|
||||||
|
|
||||||
## API 이름
|
## 이름 짓기
|
||||||
|
|
||||||
새로운 API를 만들 땐 getter, setter스타일 대신 jQuery의 one-function 스타일을
|
Electron API는 Node.js와 비슷한 명명법을 사용합니다:
|
||||||
사용해야 합니다. 예를 들어 `.getText()`와 `.setText(text)`대신에 `.text([text])`
|
|
||||||
형식으로 설계하면 됩니다. 포럼에 이 문제에 대한 [논의](https://github.com/electron/electron/issues/46)가
|
- `BrowserWindow`와 같은 모듈 자체를 뜻하는 이름은, `CamelCase`를 사용합니다.
|
||||||
|
- `globalShortcut`과 같은 API의 세트일 땐, `mixedCase`를 사용합니다.
|
||||||
|
- API가 객체의 속성일 경우, 그리고 `win.webContents`와 같이 충분히 복잡하고 분리된
|
||||||
|
부분일 경우, `mixedCase`를 사용합니다.
|
||||||
|
- 다른 모듈이 아닌 API를 구현할 땐, `<webview> Tag` 또는 `Process Object`와 같이
|
||||||
|
단순하고 자연스러운 제목을 사용합니다.
|
||||||
|
|
||||||
|
새로운 API를 만들 땐 jQuery의 one-function 스타일 대신 getter, setter스타일을
|
||||||
|
사용해야 합니다. 예를 들어 `.text([text])` 대신 `.getText()`와 `.setText(text)`
|
||||||
|
형식으로 함수를 설계하면 됩니다. 포럼에서 이 문제에 대한
|
||||||
|
[논의](https://github.com/electron/electron/issues/46)가
|
||||||
진행되고 있습니다.
|
진행되고 있습니다.
|
||||||
|
|
|
@ -99,7 +99,7 @@ win.show();
|
||||||
* `zoomFactor` Number - 界面默认缩放值, `3.0` 表示
|
* `zoomFactor` Number - 界面默认缩放值, `3.0` 表示
|
||||||
`300%`. 默认 `1.0`.
|
`300%`. 默认 `1.0`.
|
||||||
* `javascript` Boolean - 开启javascript支持. 默认为`true`.
|
* `javascript` Boolean - 开启javascript支持. 默认为`true`.
|
||||||
* `webSecurity` Boolean - 当设置为 `false`, 它将禁用相同地方的规则 (通常测试服), 并且如果有2个非用户设置的参数,就设置
|
* `webSecurity` Boolean - 当设置为 `false`, 它将禁用同源策略 (通常用来测试网站), 并且如果有2个非用户设置的参数,就设置
|
||||||
`allowDisplayingInsecureContent` 和 `allowRunningInsecureContent` 的值为
|
`allowDisplayingInsecureContent` 和 `allowRunningInsecureContent` 的值为
|
||||||
`true`. 默认为 `true`.
|
`true`. 默认为 `true`.
|
||||||
* `allowDisplayingInsecureContent` Boolean -允许一个使用 https的界面来展示由 http URLs 传过来的资源. 默认`false`.
|
* `allowDisplayingInsecureContent` Boolean -允许一个使用 https的界面来展示由 http URLs 传过来的资源. 默认`false`.
|
||||||
|
@ -758,4 +758,4 @@ windows上句柄类型为 `HWND` ,OS X `NSView*` , Linux `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
|
[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
|
||||||
|
|
87
docs-translations/zh-CN/api/frameless-window.md
Normal file
87
docs-translations/zh-CN/api/frameless-window.md
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
# 无边框窗口
|
||||||
|
|
||||||
|
无边框窗口指的是不包含除页面本身以外任何其它可视部分的窗口([chrome](https://developer.mozilla.org/en-US/docs/Glossary/Chrome))。
|
||||||
|
像工具栏,是窗口的一部分,但并不属于页面。这些是[`BrowserWindow`](browser-window.md) 类的选项。
|
||||||
|
|
||||||
|
## 创建无边框窗口
|
||||||
|
|
||||||
|
为了创建一个无边框窗口,你需要设置[BrowserWindow](browser-window.md)的`frame`为`false`:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const BrowserWindow = require('electron').BrowserWindow;
|
||||||
|
var win = new BrowserWindow({ width: 800, height: 600, frame: false });
|
||||||
|
```
|
||||||
|
|
||||||
|
### OS X上的替代方案
|
||||||
|
|
||||||
|
在Mac OS X 10.10 Yosemite或者更新的版本中,有一个替代方案去生成一个无边框窗口。
|
||||||
|
不同于设置`frame`为`false`会隐藏标题栏以及失去对窗口的控制,你可能想隐藏标题栏使你的页面内容显示在整个窗口上
|
||||||
|
,同时又想保持对窗口的控制("traffic lights")。你可以通过指定`titleBarStyle`这一新选项达到目标:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var win = new BrowserWindow({ 'titleBarStyle': 'hidden' });
|
||||||
|
```
|
||||||
|
|
||||||
|
## 透明窗口
|
||||||
|
|
||||||
|
通过设置`transparent` 选项为 `true`,你能使无边框窗口透明:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
var win = new BrowserWindow({ transparent: true, frame: false });
|
||||||
|
```
|
||||||
|
|
||||||
|
### 限制
|
||||||
|
|
||||||
|
* 你无法点击透明的区域。我们正在采用一个新的API去设置窗口的外形以解决这个问题,
|
||||||
|
详见[our issue](https://github.com/electron/electron/issues/1335)。
|
||||||
|
* 透明窗口是不可调整大小的。在某些平台上,设置`resizable`为`true`也许会造成这个透明窗口停止工作。
|
||||||
|
* `blur`滤光器器只适用于网页,所以没法将模糊效果用于窗口之下(i.e. 其它在用户的系统中打开的应用)。
|
||||||
|
* 在Windows系统中,当DWM被禁用时透明窗口不会工作。
|
||||||
|
* Linux用户需要在命令行中输入`--enable-transparent-visuals --disable-gpu`
|
||||||
|
去禁用GPU以及允许ARGB去渲染透明窗口,这是由于一个Linux上的上游bug[alpha channel doesn't work on some
|
||||||
|
NVidia drivers](https://code.google.com/p/chromium/issues/detail?id=369209)造成的
|
||||||
|
* 在Mac上,透明窗口的阴影不会显示出来.
|
||||||
|
|
||||||
|
## 可拖动区域
|
||||||
|
|
||||||
|
默认情况下,无边框窗口是不可拖动的。应用在CSS中设置`-webkit-app-region: drag`
|
||||||
|
告诉Electron哪个区域是可拖动的(比如系统标准的标题栏),应用也可以设置`-webkit-app-region: no-drag`
|
||||||
|
在可拖动区域中排除不可拖动的区域。需要注意的是,目前只支持矩形区域。
|
||||||
|
|
||||||
|
为了让整个窗口可拖动,你可以在`body`的样式中添加`-webkit-app-region: drag`:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<body style="-webkit-app-region: drag">
|
||||||
|
</body>
|
||||||
|
```
|
||||||
|
|
||||||
|
另外需要注意的是,如果你设置了整个窗口可拖动,你必须标记按钮为不可拖动的(non-draggable),
|
||||||
|
否则用户不能点击它们:
|
||||||
|
|
||||||
|
```css
|
||||||
|
button {
|
||||||
|
-webkit-app-region: no-drag;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
如果你设置一个自定义的标题栏可拖动,你同样需要设置标题栏中所有的按钮为不可拖动(non-draggable)。
|
||||||
|
|
||||||
|
## 文本选择
|
||||||
|
|
||||||
|
在一个无边框窗口中,拖动动作会与文本选择发生冲突。比如,当你拖动标题栏,偶尔会选中标题栏上的文本。
|
||||||
|
为了防止这种情况发生,你需要向下面这样在一个可拖动区域中禁用文本选择:
|
||||||
|
|
||||||
|
```css
|
||||||
|
.titlebar {
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-webkit-app-region: drag;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 上下文菜单
|
||||||
|
|
||||||
|
在一些平台上,可拖动区域会被认为是非客户端框架(non-client frame),所有当你点击右键时,一个系统菜单会弹出。
|
||||||
|
为了保证上下文菜单在所有平台下正确的显示,你不应该在可拖动区域使用自定义上下文菜单。
|
||||||
|
|
|
@ -912,4 +912,4 @@ Returns whether the window is visible on all workspaces.
|
||||||
|
|
||||||
Ignore all moused events that happened in the window.
|
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
|
[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=576
|
||||||
|
|
|
@ -109,7 +109,7 @@ var template = [
|
||||||
})(),
|
})(),
|
||||||
click: function(item, focusedWindow) {
|
click: function(item, focusedWindow) {
|
||||||
if (focusedWindow)
|
if (focusedWindow)
|
||||||
focusedWindow.toggleDevTools();
|
focusedWindow.webContents.toggleDevTools();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -20,11 +20,6 @@ control the appearance of the `webview` container:
|
||||||
```html
|
```html
|
||||||
<webview id="foo" src="https://www.github.com/" style="display:inline-flex; width:640px; height:480px"></webview>
|
<webview id="foo" src="https://www.github.com/" style="display:inline-flex; width:640px; height:480px"></webview>
|
||||||
```
|
```
|
||||||
Please note that the `webview` tag's style uses `display:flex;` internally to
|
|
||||||
ensure the child `object` element fills the full height and width of its `webview`
|
|
||||||
container when used with traditional and flexbox layouts (since v0.36.11). Please
|
|
||||||
do not overwrite the default `display:flex;` CSS property, unless specifying
|
|
||||||
`display:inline-flex;` for inline layout.
|
|
||||||
|
|
||||||
If you want to control the guest content in any way, you can write JavaScript
|
If you want to control the guest content in any way, you can write JavaScript
|
||||||
that listens for `webview` events and responds to those events using the
|
that listens for `webview` events and responds to those events using the
|
||||||
|
@ -50,6 +45,36 @@ and displays a "loading..." message during the load time:
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## CSS Styling Notes
|
||||||
|
|
||||||
|
Please note that the `webview` tag's style uses `display:flex;` internally to
|
||||||
|
ensure the child `object` element fills the full height and width of its `webview`
|
||||||
|
container when used with traditional and flexbox layouts (since v0.36.11). Please
|
||||||
|
do not overwrite the default `display:flex;` CSS property, unless specifying
|
||||||
|
`display:inline-flex;` for inline layout.
|
||||||
|
|
||||||
|
`webview` has issues being hidden using the `hidden` attribute or using `display: none;`.
|
||||||
|
It can cause unusual rendering behaviour within its child `browserplugin` object
|
||||||
|
and the web page is reloaded, when the `webview` is un-hidden, as opposed to just
|
||||||
|
becoming visible again. The recommended approach is to hide the `webview` using
|
||||||
|
CSS by zeroing the `width` & `height` and allowing the element to shrink to the 0px
|
||||||
|
dimensions via `flex`.
|
||||||
|
|
||||||
|
```html
|
||||||
|
<style>
|
||||||
|
webview {
|
||||||
|
display:inline-flex;
|
||||||
|
width:640px;
|
||||||
|
height:480px;
|
||||||
|
}
|
||||||
|
webview.hide {
|
||||||
|
flex: 0 1;
|
||||||
|
width: 0px;
|
||||||
|
height: 0px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
```
|
||||||
|
|
||||||
## Tag Attributes
|
## Tag Attributes
|
||||||
|
|
||||||
The `webview` tag has the following attributes:
|
The `webview` tag has the following attributes:
|
||||||
|
@ -479,6 +504,7 @@ Returns:
|
||||||
* `errorCode` Integer
|
* `errorCode` Integer
|
||||||
* `errorDescription` String
|
* `errorDescription` String
|
||||||
* `validatedURL` String
|
* `validatedURL` String
|
||||||
|
* `isMainFrame` Boolean
|
||||||
|
|
||||||
This event is like `did-finish-load`, but fired when the load failed or was
|
This event is like `did-finish-load`, but fired when the load failed or was
|
||||||
cancelled, e.g. `window.stop()` is invoked.
|
cancelled, e.g. `window.stop()` is invoked.
|
||||||
|
@ -737,6 +763,10 @@ Emitted when media is paused or done playing.
|
||||||
|
|
||||||
### Event: 'did-change-theme-color'
|
### Event: 'did-change-theme-color'
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
|
||||||
|
* `themeColor` String
|
||||||
|
|
||||||
Emitted when a page's theme color changes. This is usually due to encountering a meta tag:
|
Emitted when a page's theme color changes. This is usually due to encountering a meta tag:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
'product_name%': 'Electron',
|
'product_name%': 'Electron',
|
||||||
'company_name%': 'GitHub, Inc',
|
'company_name%': 'GitHub, Inc',
|
||||||
'company_abbr%': 'github',
|
'company_abbr%': 'github',
|
||||||
'version%': '0.37.5',
|
'version%': '0.37.6',
|
||||||
},
|
},
|
||||||
'includes': [
|
'includes': [
|
||||||
'filenames.gypi',
|
'filenames.gypi',
|
||||||
|
|
|
@ -7,17 +7,34 @@ const appFolder = path.dirname(process.execPath)
|
||||||
|
|
||||||
// i.e. my-app/Update.exe
|
// i.e. my-app/Update.exe
|
||||||
const updateExe = path.resolve(appFolder, '..', 'Update.exe')
|
const updateExe = path.resolve(appFolder, '..', 'Update.exe')
|
||||||
|
|
||||||
const exeName = path.basename(process.execPath)
|
const exeName = path.basename(process.execPath)
|
||||||
|
var spawnedArgs = []
|
||||||
|
var spawnedProcess
|
||||||
|
|
||||||
|
var isSameArgs = function (args) {
|
||||||
|
return (args.length === spawnedArgs.length) && args.every(function (e, i) {
|
||||||
|
return e === spawnedArgs[i]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// Spawn a command and invoke the callback when it completes with an error
|
// Spawn a command and invoke the callback when it completes with an error
|
||||||
// and the output from standard out.
|
// and the output from standard out.
|
||||||
var spawnUpdate = function (args, detached, callback) {
|
var spawnUpdate = function (args, detached, callback) {
|
||||||
var error, errorEmitted, spawnedProcess, stderr, stdout
|
var error, errorEmitted, stderr, stdout
|
||||||
|
|
||||||
try {
|
try {
|
||||||
spawnedProcess = spawn(updateExe, args, {
|
// Ensure we don't spawn multiple squirrel processes
|
||||||
detached: detached
|
// Process spawned, same args: Attach events to alread running process
|
||||||
})
|
// Process spawned, different args: Return with error
|
||||||
|
// No process spawned: Spawn new process
|
||||||
|
if (spawnedProcess && !isSameArgs(args)) {
|
||||||
|
return callback('AutoUpdater process with arugments ' + args + ' is already running')
|
||||||
|
} else if (!spawnedProcess) {
|
||||||
|
spawnedProcess = spawn(updateExe, args, {
|
||||||
|
detached: detached
|
||||||
|
})
|
||||||
|
spawnedArgs = args || []
|
||||||
|
}
|
||||||
} catch (error1) {
|
} catch (error1) {
|
||||||
error = error1
|
error = error1
|
||||||
|
|
||||||
|
@ -41,6 +58,9 @@ var spawnUpdate = function (args, detached, callback) {
|
||||||
return callback(error)
|
return callback(error)
|
||||||
})
|
})
|
||||||
return spawnedProcess.on('exit', function (code, signal) {
|
return spawnedProcess.on('exit', function (code, signal) {
|
||||||
|
spawnedProcess = undefined
|
||||||
|
spawnedArgs = []
|
||||||
|
|
||||||
// We may have already emitted an error.
|
// We may have already emitted an error.
|
||||||
if (errorEmitted) {
|
if (errorEmitted) {
|
||||||
return
|
return
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "electron",
|
"name": "electron",
|
||||||
"version": "0.37.5",
|
"version": "0.37.6",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"asar": "^0.11.0",
|
"asar": "^0.11.0",
|
||||||
"request": "*",
|
"request": "*",
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit 7b037805e0dbb5976bdca5808f0ef4c937db1f6e
|
Subproject commit bc9c496a6185e37e792c10bfc5b49ea779b27cd3
|
Loading…
Add table
Add a link
Reference in a new issue