From c0528c5049dc42ab191367b0a463274f72f46818 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 25 Sep 2015 17:50:53 +0800 Subject: [PATCH 01/65] Bump v0.33.2 --- atom.gyp | 2 +- atom/browser/resources/mac/Info.plist | 2 +- atom/browser/resources/win/atom.rc | 8 ++++---- atom/common/atom_version.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/atom.gyp b/atom.gyp index 3a46f242a2..41d671d7a2 100644 --- a/atom.gyp +++ b/atom.gyp @@ -4,7 +4,7 @@ 'product_name%': 'Electron', 'company_name%': 'GitHub, Inc', 'company_abbr%': 'github', - 'version%': '0.33.1', + 'version%': '0.33.2', }, 'includes': [ 'filenames.gypi', diff --git a/atom/browser/resources/mac/Info.plist b/atom/browser/resources/mac/Info.plist index 6260173b82..745b12520c 100644 --- a/atom/browser/resources/mac/Info.plist +++ b/atom/browser/resources/mac/Info.plist @@ -17,7 +17,7 @@ CFBundleIconFile atom.icns CFBundleVersion - 0.33.1 + 0.33.2 LSMinimumSystemVersion 10.8.0 NSMainNibFile diff --git a/atom/browser/resources/win/atom.rc b/atom/browser/resources/win/atom.rc index 0583c2df3b..e0b9fa5cfe 100644 --- a/atom/browser/resources/win/atom.rc +++ b/atom/browser/resources/win/atom.rc @@ -56,8 +56,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,33,1,0 - PRODUCTVERSION 0,33,1,0 + FILEVERSION 0,33,2,0 + PRODUCTVERSION 0,33,2,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -74,12 +74,12 @@ BEGIN BEGIN VALUE "CompanyName", "GitHub, Inc." VALUE "FileDescription", "Electron" - VALUE "FileVersion", "0.33.1" + VALUE "FileVersion", "0.33.2" VALUE "InternalName", "electron.exe" VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved." VALUE "OriginalFilename", "electron.exe" VALUE "ProductName", "Electron" - VALUE "ProductVersion", "0.33.1" + VALUE "ProductVersion", "0.33.2" VALUE "SquirrelAwareVersion", "1" END END diff --git a/atom/common/atom_version.h b/atom/common/atom_version.h index 5f9d0f3ca0..56dcd67fb0 100644 --- a/atom/common/atom_version.h +++ b/atom/common/atom_version.h @@ -7,7 +7,7 @@ #define ATOM_MAJOR_VERSION 0 #define ATOM_MINOR_VERSION 33 -#define ATOM_PATCH_VERSION 1 +#define ATOM_PATCH_VERSION 2 #define ATOM_VERSION_IS_RELEASE 1 From 775c90b7337bcb74a3d5d21f803f4a7034c6ff24 Mon Sep 17 00:00:00 2001 From: Josh Abernathy Date: Fri, 25 Sep 2015 11:37:30 -0400 Subject: [PATCH 02/65] Use 0.8.0. This picks up the fix for https://github.com/atom/atom/issues/7061. --- script/update-external-binaries.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/update-external-binaries.py b/script/update-external-binaries.py index 49e73435ab..fae268ea8c 100755 --- a/script/update-external-binaries.py +++ b/script/update-external-binaries.py @@ -8,7 +8,7 @@ from lib.config import get_target_arch from lib.util import safe_mkdir, rm_rf, extract_zip, tempdir, download -VERSION = 'v0.7.0' +VERSION = 'v0.8.0' SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) FRAMEWORKS_URL = 'http://github.com/atom/atom-shell-frameworks/releases' \ '/download/' + VERSION From 56520159f73ba6fbc3faa41a6c0977e923c4e088 Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Sat, 26 Sep 2015 10:36:26 +0900 Subject: [PATCH 03/65] Update as upstream, fix small typo --- docs-translations/ko-KR/api/session.md | 8 ++---- .../ko-KR/tutorial/quick-start.md | 1 + .../tutorial/using-native-node-modules.md | 27 ++++++++++--------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/docs-translations/ko-KR/api/session.md b/docs-translations/ko-KR/api/session.md index cb912aabb1..4c6ead1647 100644 --- a/docs-translations/ko-KR/api/session.md +++ b/docs-translations/ko-KR/api/session.md @@ -17,11 +17,7 @@ var session = win.webContents.session ### Event: 'will-download' * `event` Event -* `item` Object - * `url` String - * `filename` String - * `mimeType` String - * `hasUserGesture` Boolean +* `item` [DownloadItem](download-item.md) * `webContents` [WebContents](web-contents.md) Electron의 `webContents`에서 `item`을 다운로드할 때 발생하는 이벤트입니다. @@ -31,7 +27,7 @@ Electron의 `webContents`에서 `item`을 다운로드할 때 발생하는 이 ```javascript session.on('will-download', function(event, item, webContents) { event.preventDefault(); - require('request')(item.url, function(data) { + require('request')(item.getUrl(), function(data) { require('fs').writeFileSync('/somewhere', data); }); }); diff --git a/docs-translations/ko-KR/tutorial/quick-start.md b/docs-translations/ko-KR/tutorial/quick-start.md index 8c2e043061..4a6ce6d225 100644 --- a/docs-translations/ko-KR/tutorial/quick-start.md +++ b/docs-translations/ko-KR/tutorial/quick-start.md @@ -111,6 +111,7 @@ app.on('ready', function() { + 헬로 월드! diff --git a/docs-translations/ko-KR/tutorial/using-native-node-modules.md b/docs-translations/ko-KR/tutorial/using-native-node-modules.md index 913c300be8..ed64abb492 100644 --- a/docs-translations/ko-KR/tutorial/using-native-node-modules.md +++ b/docs-translations/ko-KR/tutorial/using-native-node-modules.md @@ -29,7 +29,20 @@ npm install --save-dev electron-rebuild node ./node_modules/.bin/electron-rebuild ``` -### node-gyp을 이용한 방법 +### `npm`을 이용한 방법 + +또한 `npm`을 통해 설치할 수도 있습니다. +환경변수가 필요한 것을 제외하고 일반 Node 모듈을 설치하는 방법과 완전히 똑같습니다: + +```bash +export npm_config_disturl=https://atom.io/download/atom-shell +export npm_config_target=0.33.1 +export npm_config_arch=x64 +export npm_config_runtime=electron +HOME=~/.electron-gyp npm install module-name +``` + +### `node-gyp`를 이용한 방법 Node 모듈을 `node-gyp`를 사용하여 Electron을 타겟으로 빌드할 때는 `node-gyp`에 헤더 다운로드 주소와 버전을 알려주어야 합니다: @@ -40,15 +53,3 @@ $ HOME=~/.electron-gyp node-gyp rebuild --target=0.29.1 --arch=x64 --dist-url=ht `HOME=~/.electron-gyp`은 변경할 헤더의 위치를 찾습니다. `--target=0.29.1`은 Electron의 버전입니다. `--dist-url=...`은 헤더를 다운로드 하는 주소입니다. `--arch=x64`는 64비트 시스템을 타겟으로 빌드 한다는 것을 `node-gyp`에게 알려줍니다. - -### npm을 이용한 방법 - -또한 `npm`을 통해 설치할 수도 있습니다. -환경변수가 필요한 것을 제외하고 일반 Node 모듈을 설치하는 방법과 완전히 똑같습니다: - -```bash -export npm_config_disturl=https://atom.io/download/atom-shell -export npm_config_target=0.29.1 -export npm_config_arch=x64 -HOME=~/.electron-gyp npm install module-name -``` From 690f859a78cb1928b299fc126b8f8720044cdc33 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 26 Sep 2015 22:06:01 +0800 Subject: [PATCH 04/65] Bump v0.33.3 --- atom.gyp | 2 +- atom/browser/resources/mac/Info.plist | 2 +- atom/browser/resources/win/atom.rc | 8 ++++---- atom/common/atom_version.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/atom.gyp b/atom.gyp index 41d671d7a2..42069ea846 100644 --- a/atom.gyp +++ b/atom.gyp @@ -4,7 +4,7 @@ 'product_name%': 'Electron', 'company_name%': 'GitHub, Inc', 'company_abbr%': 'github', - 'version%': '0.33.2', + 'version%': '0.33.3', }, 'includes': [ 'filenames.gypi', diff --git a/atom/browser/resources/mac/Info.plist b/atom/browser/resources/mac/Info.plist index 745b12520c..eb39cb35f9 100644 --- a/atom/browser/resources/mac/Info.plist +++ b/atom/browser/resources/mac/Info.plist @@ -17,7 +17,7 @@ CFBundleIconFile atom.icns CFBundleVersion - 0.33.2 + 0.33.3 LSMinimumSystemVersion 10.8.0 NSMainNibFile diff --git a/atom/browser/resources/win/atom.rc b/atom/browser/resources/win/atom.rc index e0b9fa5cfe..6fba6cf806 100644 --- a/atom/browser/resources/win/atom.rc +++ b/atom/browser/resources/win/atom.rc @@ -56,8 +56,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,33,2,0 - PRODUCTVERSION 0,33,2,0 + FILEVERSION 0,33,3,0 + PRODUCTVERSION 0,33,3,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -74,12 +74,12 @@ BEGIN BEGIN VALUE "CompanyName", "GitHub, Inc." VALUE "FileDescription", "Electron" - VALUE "FileVersion", "0.33.2" + VALUE "FileVersion", "0.33.3" VALUE "InternalName", "electron.exe" VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved." VALUE "OriginalFilename", "electron.exe" VALUE "ProductName", "Electron" - VALUE "ProductVersion", "0.33.2" + VALUE "ProductVersion", "0.33.3" VALUE "SquirrelAwareVersion", "1" END END diff --git a/atom/common/atom_version.h b/atom/common/atom_version.h index 56dcd67fb0..4f24034754 100644 --- a/atom/common/atom_version.h +++ b/atom/common/atom_version.h @@ -7,7 +7,7 @@ #define ATOM_MAJOR_VERSION 0 #define ATOM_MINOR_VERSION 33 -#define ATOM_PATCH_VERSION 2 +#define ATOM_PATCH_VERSION 3 #define ATOM_VERSION_IS_RELEASE 1 From 9f30e5f52635c797f633fbbc1c4417f1fad5664b Mon Sep 17 00:00:00 2001 From: Gohy Leandre Date: Sat, 26 Sep 2015 17:23:34 +0200 Subject: [PATCH 05/65] Add ability to preload modules (--require, -r) --- atom/browser/default_app/main.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/atom/browser/default_app/main.js b/atom/browser/default_app/main.js index 4d854dc35c..1b92685d13 100644 --- a/atom/browser/default_app/main.js +++ b/atom/browser/default_app/main.js @@ -13,8 +13,8 @@ app.on('window-all-closed', function() { // Parse command line options. var argv = process.argv.slice(1); -var option = { file: null, help: null, version: null, webdriver: null }; -for (var i in argv) { +var option = { file: null, help: null, version: null, webdriver: null, modules: [] }; +for (var i = 0; i < argv.length; i++) { if (argv[i] == '--version' || argv[i] == '-v') { option.version = true; break; @@ -23,6 +23,9 @@ for (var i in argv) { break; } else if (argv[i] == '--test-type=webdriver') { option.webdriver = true; + } else if (argv[i] == '--require' || argv[i] == '-r') { + option.modules.push(argv[++i]); + continue; } else if (argv[i][0] == '-') { continue; } else { @@ -212,6 +215,10 @@ app.once('ready', function() { Menu.setApplicationMenu(menu); }); +if (option.modules.length > 0) { + require('module')._preloadModules(option.modules); +} + // Start the specified app if there is one specified in command line, otherwise // start the default app. if (option.file && !option.webdriver) { @@ -253,6 +260,7 @@ if (option.file && !option.webdriver) { helpMessage += "A path to an Electron application may be specified. The path must be to \n"; helpMessage += "an index.js file or to a folder containing a package.json or index.js file.\n\n"; helpMessage += "Options:\n"; + helpMessage += " -r, --require Module to preload (option can be repeated)"; helpMessage += " -h, --help Print this usage message.\n"; helpMessage += " -v, --version Print the version."; console.log(helpMessage); From 457147365af2bbd3b69a0bf35cac8ce78110b76c Mon Sep 17 00:00:00 2001 From: fscherwi Date: Sun, 27 Sep 2015 14:44:28 +0200 Subject: [PATCH 06/65] standardize package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 101fdeee25..a125d13b68 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,11 @@ { "name": "electron", "devDependencies": { - "asar": "0.8.x", + "asar": "^0.8.0", "coffee-script": "^1.9.2", "coffeelint": "^1.9.4", "request": "*", - "runas": "3.x" + "runas": "^3.0.0" }, "private": true, "scripts": { From 397fbeae28db234b042baf144aa61f952e43d3b5 Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Sun, 27 Sep 2015 22:20:35 +0900 Subject: [PATCH 07/65] Update example variable name prefix (atom to electron) * Update variable name prefix as `atom` to `electron` --- docs-translations/ko-KR/api/screen.md | 10 +++++----- docs/api/screen.md | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs-translations/ko-KR/api/screen.md b/docs-translations/ko-KR/api/screen.md index 26975cbb1e..5e0805749f 100644 --- a/docs-translations/ko-KR/api/screen.md +++ b/docs-translations/ko-KR/api/screen.md @@ -6,7 +6,7 @@ `screen`은 [EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter)를 상속 받았습니다. **참고:** 랜더러 / DevTools에선 이미 DOM 속성이 `window.screen`을 가지고 있으므로 `screen = require('screen')` 형식으로 모듈을 사용할 수 없습니다. -밑의 예제와 같이 `atomScreen` 같은 이름으로 모듈 이름을 대체하여 사용해야 합니다. +밑의 예제와 같이 `electronScreen` 같은 이름으로 모듈 이름을 대체하여 사용해야 합니다. 다음 예제는 화면 전체를 채우는 윈도우 창을 생성합니다: @@ -17,8 +17,8 @@ var BrowserWindow = require('browser-window'); var mainWindow; app.on('ready', function() { - var atomScreen = require('screen'); - var size = atomScreen.getPrimaryDisplay().workAreaSize; + var electronScreen = require('screen'); + var size = electronScreen.getPrimaryDisplay().workAreaSize; mainWindow = new BrowserWindow({ width: size.width, height: size.height }); }); ``` @@ -32,8 +32,8 @@ var BrowserWindow = require('browser-window'); var mainWindow; app.on('ready', function() { - var atomScreen = require('screen'); - var displays = atomScreen.getAllDisplays(); + var electronScreen = require('screen'); + var displays = electronScreen.getAllDisplays(); var externalDisplay = null; for (var i in displays) { if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { diff --git a/docs/api/screen.md b/docs/api/screen.md index 934e3eaf5a..da15c7326f 100644 --- a/docs/api/screen.md +++ b/docs/api/screen.md @@ -8,7 +8,7 @@ position, etc. You should not use this module until the `ready` event of the **Note:** In the renderer / DevTools, `window.screen` is a reserved DOM property, so writing `var screen = require('screen')` will not work. In our -examples below, we use `atomScreen` as the variable name instead. +examples below, we use `electronScreen` as the variable name instead. An example of creating a window that fills the whole screen: @@ -19,8 +19,8 @@ var BrowserWindow = require('browser-window'); var mainWindow; app.on('ready', function() { - var atomScreen = require('screen'); - var size = atomScreen.getPrimaryDisplay().workAreaSize; + var electronScreen = require('screen'); + var size = electronScreen.getPrimaryDisplay().workAreaSize; mainWindow = new BrowserWindow({ width: size.width, height: size.height }); }); ``` @@ -34,8 +34,8 @@ var BrowserWindow = require('browser-window'); var mainWindow; app.on('ready', function() { - var atomScreen = require('screen'); - var displays = atomScreen.getAllDisplays(); + var electronScreen = require('screen'); + var displays = electronScreen.getAllDisplays(); var externalDisplay = null; for (var i in displays) { if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { From fc7f4ae24be37e7414887a7540f16d4167dd3762 Mon Sep 17 00:00:00 2001 From: Robo Date: Sun, 27 Sep 2015 18:49:52 +0530 Subject: [PATCH 08/65] session: api to emulate network conditions --- atom/browser/api/atom_api_session.cc | 41 ++++++++++++++++++++++++++++ atom/browser/api/atom_api_session.h | 3 ++ docs/api/session.md | 15 ++++++++++ 3 files changed, 59 insertions(+) diff --git a/atom/browser/api/atom_api_session.cc b/atom/browser/api/atom_api_session.cc index 7d5f75cac0..7bc1a2153e 100644 --- a/atom/browser/api/atom_api_session.cc +++ b/atom/browser/api/atom_api_session.cc @@ -19,6 +19,8 @@ #include "base/prefs/pref_service.h" #include "base/strings/string_util.h" #include "base/thread_task_runner_handle.h" +#include "brightray/browser/net/devtools_network_conditions.h" +#include "brightray/browser/net/devtools_network_controller.h" #include "chrome/common/pref_names.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/storage_partition.h" @@ -294,6 +296,43 @@ void Session::SetDownloadPath(const base::FilePath& path) { prefs::kDownloadDefaultDirectory, path); } +void Session::EnableNetworkEmulation(const mate::Dictionary& options) { + scoped_ptr conditions; + bool offline = false; + double latency, download_throughput, upload_throughput; + if (options.Get("offline", &offline) && offline) { + conditions.reset(new brightray::DevToolsNetworkConditions(offline)); + } else { + options.Get("latency", &latency); + options.Get("downloadThroughput", &download_throughput); + options.Get("uploadThroughput", &upload_throughput); + conditions.reset( + new brightray::DevToolsNetworkConditions(false, + latency, + download_throughput, + upload_throughput)); + } + auto controller = browser_context_->GetDevToolsNetworkController(); + + BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, + base::Bind(&brightray::DevToolsNetworkController::SetNetworkState, + base::Unretained(controller), + std::string(), + base::Passed(&conditions))); +} + +void Session::DisableNetworkEmulation() { + scoped_ptr conditions( + new brightray::DevToolsNetworkConditions(false)); + auto controller = browser_context_->GetDevToolsNetworkController(); + + BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, + base::Bind(&brightray::DevToolsNetworkController::SetNetworkState, + base::Unretained(controller), + std::string(), + base::Passed(&conditions))); +} + v8::Local Session::Cookies(v8::Isolate* isolate) { if (cookies_.IsEmpty()) { auto handle = atom::api::Cookies::Create(isolate, browser_context()); @@ -310,6 +349,8 @@ mate::ObjectTemplateBuilder Session::GetObjectTemplateBuilder( .SetMethod("clearStorageData", &Session::ClearStorageData) .SetMethod("setProxy", &Session::SetProxy) .SetMethod("setDownloadPath", &Session::SetDownloadPath) + .SetMethod("enableNetworkEmulation", &Session::EnableNetworkEmulation) + .SetMethod("disableNetworkEmulation", &Session::DisableNetworkEmulation) .SetProperty("cookies", &Session::Cookies); } diff --git a/atom/browser/api/atom_api_session.h b/atom/browser/api/atom_api_session.h index 14406e57af..68ee3634e6 100644 --- a/atom/browser/api/atom_api_session.h +++ b/atom/browser/api/atom_api_session.h @@ -20,6 +20,7 @@ class FilePath; namespace mate { class Arguments; +class Dictionary; } namespace atom { @@ -65,6 +66,8 @@ class Session: public mate::TrackableObject, void ClearStorageData(mate::Arguments* args); void SetProxy(const std::string& proxy, const base::Closure& callback); void SetDownloadPath(const base::FilePath& path); + void EnableNetworkEmulation(const mate::Dictionary& options); + void DisableNetworkEmulation(); v8::Local Cookies(v8::Isolate* isolate); // Cached object for cookies API. diff --git a/docs/api/session.md b/docs/api/session.md index 64991ab753..36a92f296e 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -191,3 +191,18 @@ proxy-uri = ["://"][":"] Sets download saving directory. By default, the download directory will be the `Downloads` under the respective app folder. + +### `session.enableNetworkEmulation(options)` + +* `options` Object + * `offline` Boolean - Whether to emulate network outage. + * `latency` Double - RTT in ms + * `downloadThroughput` Double - Download rate in Bps + * `uploadThroughput` Double - Upload rate in Bps + +Emulates network with the given configuration for the `session`. + +### `session.disableNetworkEmulation` + +Disables any network emulation already active for the `session`. Resets to +the original network configuration. From 6dcc752f6742d150ce909ffffae270355234c608 Mon Sep 17 00:00:00 2001 From: Eran Tiktin Date: Mon, 28 Sep 2015 02:12:47 +0300 Subject: [PATCH 09/65] Set default extension in Windows file dialog On Windows when you open the save dialog and switch the filter, the extension is supposed to change accordingly. It didn't happen with the existing code, since the existing code didn't set the default extension (should be set to the first filter). This resolves #2915. --- atom/browser/ui/file_dialog_win.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/atom/browser/ui/file_dialog_win.cc b/atom/browser/ui/file_dialog_win.cc index b169471c6e..da00dc54e2 100644 --- a/atom/browser/ui/file_dialog_win.cc +++ b/atom/browser/ui/file_dialog_win.cc @@ -79,6 +79,9 @@ class FileDialog { if (!title.empty()) GetPtr()->SetTitle(base::UTF8ToUTF16(title).c_str()); + if (!filterspec.empty()) + GetPtr()->SetDefaultExtension(filterspec.front().pszSpec); + SetDefaultFolder(default_path); } From 82bb7905300f6bd906279df81bfe61a82d35e2da Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 28 Sep 2015 12:48:33 +0800 Subject: [PATCH 10/65] Style fix for #2918 --- atom/common/native_mate_converters/blink_converter.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atom/common/native_mate_converters/blink_converter.cc b/atom/common/native_mate_converters/blink_converter.cc index a723df1ea9..0a599bfdf0 100644 --- a/atom/common/native_mate_converters/blink_converter.cc +++ b/atom/common/native_mate_converters/blink_converter.cc @@ -166,8 +166,8 @@ bool Converter::FromV8( if (shifted) out->modifiers |= blink::WebInputEvent::ShiftKey; out->setKeyIdentifierFromWindowsKeyCode(); - if (out->type == blink::WebInputEvent::Char - || out->type == blink::WebInputEvent::RawKeyDown) { + if (out->type == blink::WebInputEvent::Char || + out->type == blink::WebInputEvent::RawKeyDown) { out->text[0] = code; out->unmodifiedText[0] = code; } From 442c79abe0a36d38961177e738d0ffa35cbb81d7 Mon Sep 17 00:00:00 2001 From: Robo Date: Mon, 28 Sep 2015 12:39:55 +0530 Subject: [PATCH 11/65] update brightray --- vendor/brightray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/brightray b/vendor/brightray index 8e443520e6..75f7d3fd88 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 8e443520e695674fd26585cfa24a0ec0b6140c27 +Subproject commit 75f7d3fd88ae60026a0717b93e3bf7182f827dc3 From db0732b35be691081ced67c219cb783e9ab2330a Mon Sep 17 00:00:00 2001 From: Robo Date: Mon, 28 Sep 2015 12:52:50 +0530 Subject: [PATCH 12/65] add examples --- docs/api/session.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/api/session.md b/docs/api/session.md index 36a92f296e..392b682641 100644 --- a/docs/api/session.md +++ b/docs/api/session.md @@ -202,6 +202,18 @@ Sets download saving directory. By default, the download directory will be the Emulates network with the given configuration for the `session`. +```javascript +// To emulate a GPRS connection with 50kbps throughput and 500 ms latency. +window.webContents.session.enableNetworkEmulation({ + latency: 500, + downloadThroughput: 6400, + uploadThroughput: 6400 +}); + +// To emulate a network outage. +window.webContents.session.enableNetworkEmulation({offline: true}); +``` + ### `session.disableNetworkEmulation` Disables any network emulation already active for the `session`. Resets to From 1b18a4dfad30a2437f72706ccee1c17a09b3683f Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 28 Sep 2015 15:34:52 +0800 Subject: [PATCH 13/65] Update node, fixes #2916 --- vendor/node | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/node b/vendor/node index ac25693ad1..f4243f5c84 160000 --- a/vendor/node +++ b/vendor/node @@ -1 +1 @@ -Subproject commit ac25693ad1d4c248e69a89147fd3995c3bf6c946 +Subproject commit f4243f5c84a371632d8d72a1a2210a0e994afdcc From fa95d32475e30120e8d93e2dcf3a4d91f416e06c Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Tue, 29 Sep 2015 05:35:33 +0900 Subject: [PATCH 14/65] Update as upstream, small changes --- docs-translations/ko-KR/api/screen.md | 2 +- docs-translations/ko-KR/api/session.md | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/docs-translations/ko-KR/api/screen.md b/docs-translations/ko-KR/api/screen.md index 5e0805749f..2d3c02f854 100644 --- a/docs-translations/ko-KR/api/screen.md +++ b/docs-translations/ko-KR/api/screen.md @@ -6,7 +6,7 @@ `screen`은 [EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter)를 상속 받았습니다. **참고:** 랜더러 / DevTools에선 이미 DOM 속성이 `window.screen`을 가지고 있으므로 `screen = require('screen')` 형식으로 모듈을 사용할 수 없습니다. -밑의 예제와 같이 `electronScreen` 같은 이름으로 모듈 이름을 대체하여 사용해야 합니다. +아래의 예제와 같이 `electronScreen` 같은 이름으로 모듈 이름을 대체하여 사용해야 합니다. 다음 예제는 화면 전체를 채우는 윈도우 창을 생성합니다: diff --git a/docs-translations/ko-KR/api/session.md b/docs-translations/ko-KR/api/session.md index 4c6ead1647..96d38dda5d 100644 --- a/docs-translations/ko-KR/api/session.md +++ b/docs-translations/ko-KR/api/session.md @@ -181,3 +181,29 @@ proxy-uri = ["://"][":"] * `path` String - 다운로드 위치 다운로드 저장 위치를 지정합니다. 기본 다운로드 위치는 각 어플리케이션 데이터 디렉터리의 `Downloads` 폴더입니다. + +### `session.enableNetworkEmulation(options)` + +* `options` Object + * `offline` Boolean - 네트워크의 오프라인 상태 여부 + * `latency` Double - 밀리세컨드 단위의 RTT + * `downloadThroughput` Double - Bps 단위의 다운로드 주기 + * `uploadThroughput` Double - Bps 단위의 업로드 주기 + +제공된 설정으로 `session`의 네트워크를 에뮬레이트합니다. + +```javascript +// 50kbps의 처리량과 함께 500ms의 레이턴시로 GPRS 연결을 에뮬레이트합니다. +window.webContents.session.enableNetworkEmulation({ + latency: 500, + downloadThroughput: 6400, + uploadThroughput: 6400 +}); + +// 네트워크가 끊긴 상태를 에뮬레이트합니다. +window.webContents.session.enableNetworkEmulation({offline: true}); +``` + +### `session.disableNetworkEmulation` + +활성화된 `session`의 에뮬레이션을 비활성화합니다. 기본 네트워크 설정으로 돌아갑니다. From ee0f0f6cfcd41f3f70399922bec08d1f109317ed Mon Sep 17 00:00:00 2001 From: Eran Tiktin Date: Tue, 29 Sep 2015 02:20:09 +0300 Subject: [PATCH 15/65] Fix window state events on Windows This commit fixes the issue we had with window state events not firing when triggered through Aero Snap. Instead of listening to command from the system menu (SC_MAXIMIZE etc.), we use the WM_SIZE event. This resolves #1381. --- atom/browser/native_window_views.cc | 99 ++++++++++++++++++++--------- atom/browser/native_window_views.h | 8 ++- 2 files changed, 73 insertions(+), 34 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 70707219f3..34c2f62263 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -169,9 +169,6 @@ NativeWindowViews::NativeWindowViews( menu_bar_autohide_(false), menu_bar_visible_(false), menu_bar_alt_pressed_(false), -#if defined(OS_WIN) - is_minimized_(false), -#endif keyboard_event_handler_(new views::UnhandledKeyboardEventHandler), use_content_size_(false), resizable_(true) { @@ -228,6 +225,9 @@ NativeWindowViews::NativeWindowViews( window_->Init(params); + bool fullscreen = false; + options.Get(switches::kFullscreen, &fullscreen); + #if defined(USE_X11) // Start monitoring window states. window_state_watcher_.reset(new WindowStateWatcher(this)); @@ -253,8 +253,7 @@ NativeWindowViews::NativeWindowViews( } // Before the window is mapped, there is no SHOW_FULLSCREEN_STATE. - bool fullscreen = false; - if (options.Get(switches::kFullscreen, & fullscreen) && fullscreen) { + if (fullscreen) { state_atom_list.push_back(GetAtom("_NET_WM_STATE_FULLSCREEN")); } @@ -278,6 +277,12 @@ NativeWindowViews::NativeWindowViews( bounds = ContentBoundsToWindowBounds(bounds); #if defined(OS_WIN) + // Save initial window state. + if (fullscreen) + last_window_state_ = ui::SHOW_STATE_FULLSCREEN; + else + last_window_state_ = ui::SHOW_STATE_NORMAL; + if (!has_frame()) { // Set Window style so that we get a minimize and maximize animation when // frameless. @@ -391,11 +396,16 @@ bool NativeWindowViews::IsMinimized() { void NativeWindowViews::SetFullScreen(bool fullscreen) { #if defined(OS_WIN) // There is no native fullscreen state on Windows. - window_->SetFullscreen(fullscreen); - if (fullscreen) + if (fullscreen) { + last_window_state_ = ui::SHOW_STATE_FULLSCREEN; NotifyWindowEnterFullScreen(); - else + } else { + last_window_state_ = ui::SHOW_STATE_NORMAL; NotifyWindowLeaveFullScreen(); + } + // We set the new value after notifying, so we can handle the size event + // correctly. + window_->SetFullscreen(fullscreen); #else if (IsVisible()) window_->SetFullscreen(fullscreen); @@ -807,24 +817,8 @@ void NativeWindowViews::OnWidgetMove() { #if defined(OS_WIN) bool NativeWindowViews::ExecuteWindowsCommand(int command_id) { - // Windows uses the 4 lower order bits of |command_id| for type-specific - // information so we must exclude this when comparing. - static const int sc_mask = 0xFFF0; - if ((command_id & sc_mask) == SC_MINIMIZE) { - NotifyWindowMinimize(); - is_minimized_ = true; - } else if ((command_id & sc_mask) == SC_RESTORE) { - if (is_minimized_) - NotifyWindowRestore(); - else - NotifyWindowUnmaximize(); - is_minimized_ = false; - } else if ((command_id & sc_mask) == SC_MAXIMIZE) { - NotifyWindowMaximize(); - } else { - std::string command = AppCommandToString(command_id); - NotifyWindowExecuteWindowsCommand(command); - } + std::string command = AppCommandToString(command_id); + NotifyWindowExecuteWindowsCommand(command); return false; } #endif @@ -844,11 +838,54 @@ void NativeWindowViews::GetDevToolsWindowWMClass( #if defined(OS_WIN) bool NativeWindowViews::PreHandleMSG( UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) { - // Handle thumbar button click message. - if (message == WM_COMMAND && HIWORD(w_param) == THBN_CLICKED) - return taskbar_host_.HandleThumbarButtonEvent(LOWORD(w_param)); - else - return false; + switch (message) { + case WM_COMMAND: + // Handle thumbar button click message. + if (HIWORD(w_param) == THBN_CLICKED) + return taskbar_host_.HandleThumbarButtonEvent(LOWORD(w_param)); + return false; + case WM_SIZE: + // Handle window state change. + HandleSizeEvent(w_param, l_param); + return false; + default: + return false; + } +} + +void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) { + // Here we handle the WM_SIZE event in order to figure out what is the current + // window state and notify the user accordingly. + switch (w_param) { + case SIZE_MAXIMIZED: + last_window_state_ = ui::SHOW_STATE_MAXIMIZED; + NotifyWindowMaximize(); + break; + case SIZE_MINIMIZED: + last_window_state_ = ui::SHOW_STATE_MINIMIZED; + NotifyWindowMinimize(); + break; + case SIZE_RESTORED: + if (last_window_state_ == ui::SHOW_STATE_NORMAL) + return; + + switch (last_window_state_) { + case ui::SHOW_STATE_MAXIMIZED: + last_window_state_ = ui::SHOW_STATE_NORMAL; + NotifyWindowUnmaximize(); + break; + case ui::SHOW_STATE_MINIMIZED: + if (IsFullscreen()) { + last_window_state_ = ui::SHOW_STATE_FULLSCREEN; + NotifyWindowEnterFullScreen(); + } else { + last_window_state_ = ui::SHOW_STATE_NORMAL; + NotifyWindowRestore(); + } + break; + } + break; + } } #endif diff --git a/atom/browser/native_window_views.h b/atom/browser/native_window_views.h index 355f5bd38e..70c722c7d9 100644 --- a/atom/browser/native_window_views.h +++ b/atom/browser/native_window_views.h @@ -142,6 +142,8 @@ class NativeWindowViews : public NativeWindow, // MessageHandlerDelegate: bool PreHandleMSG( UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) override; + + void HandleSizeEvent(WPARAM w_param, LPARAM l_param); #endif // NativeWindow: @@ -178,9 +180,9 @@ class NativeWindowViews : public NativeWindow, #elif defined(OS_WIN) // Weak ref. AtomDesktopWindowTreeHostWin* atom_desktop_window_tree_host_win_; - // Records window was whether restored from minimized state or maximized - // state. - bool is_minimized_; + + ui::WindowShowState last_window_state_; + // In charge of running taskbar related APIs. TaskbarHost taskbar_host_; #endif From a0dcfc57b29ec241f7da2053fc8bf3b99383c0da Mon Sep 17 00:00:00 2001 From: My-khael Pierce Date: Mon, 28 Sep 2015 23:09:13 -0400 Subject: [PATCH 16/65] Update quick-start.md --- docs/tutorial/quick-start.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/quick-start.md b/docs/tutorial/quick-start.md index 4ce65a1dc1..94368df09c 100644 --- a/docs/tutorial/quick-start.md +++ b/docs/tutorial/quick-start.md @@ -143,8 +143,8 @@ working as expected. ### electron-prebuilt -If you've installed `electron-prebuilt` globally with `npm`, then you need only -run the following in your app's source directory: +If you've installed `electron-prebuilt` globally with `npm`, then you will only need +to run the following in your app's source directory: ```bash electron . @@ -158,7 +158,7 @@ If you've installed it locally, then run: ### Manually Downloaded Electron Binary -If you downloaded Electron manually, you can also just use the included +If you downloaded Electron manually, you can also use the included binary to execute your app directly. #### Windows From 464134a31ab439535fe406e90428ccca6f911de9 Mon Sep 17 00:00:00 2001 From: Robo Date: Tue, 29 Sep 2015 17:47:26 +0530 Subject: [PATCH 17/65] protocol: allowing default clients to handle external unhandled protocols --- atom/browser/atom_browser_client.cc | 9 ++++ atom/browser/atom_browser_client.h | 6 +++ ...owser_resource_dispatcher_host_delegate.cc | 54 +++++++++++++++++++ ...rowser_resource_dispatcher_host_delegate.h | 29 ++++++++++ filenames.gypi | 2 + 5 files changed, 100 insertions(+) create mode 100644 atom/browser/atom_browser_resource_dispatcher_host_delegate.cc create mode 100644 atom/browser/atom_browser_resource_dispatcher_host_delegate.h diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index e45caceab0..dface840d7 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -11,6 +11,7 @@ #include "atom/browser/atom_access_token_store.h" #include "atom/browser/atom_browser_context.h" #include "atom/browser/atom_browser_main_parts.h" +#include "atom/browser/atom_browser_resource_dispatcher_host_delegate.h" #include "atom/browser/atom_quota_permission_context.h" #include "atom/browser/atom_speech_recognition_manager_delegate.h" #include "atom/browser/browser.h" @@ -30,6 +31,7 @@ #include "content/public/browser/client_certificate_delegate.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" +#include "content/public/browser/resource_dispatcher_host.h" #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents.h" #include "content/public/common/web_preferences.h" @@ -226,6 +228,13 @@ void AtomBrowserClient::SelectClientCertificate( delegate.Pass()); } +void AtomBrowserClient::ResourceDispatcherHostCreated() { + resource_dispatcher_host_delegate_.reset( + new AtomResourceDispatcherHostDelegate); + content::ResourceDispatcherHost::Get()->SetDelegate( + resource_dispatcher_host_delegate_.get()); +} + brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts( const content::MainFunctionParams&) { v8::V8::Initialize(); // Init V8 before creating main parts. diff --git a/atom/browser/atom_browser_client.h b/atom/browser/atom_browser_client.h index a0217efede..ee4700456c 100644 --- a/atom/browser/atom_browser_client.h +++ b/atom/browser/atom_browser_client.h @@ -23,6 +23,8 @@ class SSLCertRequestInfo; namespace atom { +class AtomResourceDispatcherHostDelegate; + class AtomBrowserClient : public brightray::BrowserClient, public content::RenderProcessHostObserver { public: @@ -56,6 +58,7 @@ class AtomBrowserClient : public brightray::BrowserClient, content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, scoped_ptr delegate) override; + void ResourceDispatcherHostCreated() override; // brightray::BrowserClient: brightray::BrowserMainParts* OverrideCreateBrowserMainParts( @@ -68,6 +71,9 @@ class AtomBrowserClient : public brightray::BrowserClient, // pending_render_process => current_render_process. std::map pending_processes_; + scoped_ptr + resource_dispatcher_host_delegate_; + DISALLOW_COPY_AND_ASSIGN(AtomBrowserClient); }; diff --git a/atom/browser/atom_browser_resource_dispatcher_host_delegate.cc b/atom/browser/atom_browser_resource_dispatcher_host_delegate.cc new file mode 100644 index 0000000000..9e02f7cc81 --- /dev/null +++ b/atom/browser/atom_browser_resource_dispatcher_host_delegate.cc @@ -0,0 +1,54 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#include "atom/browser/atom_browser_resource_dispatcher_host_delegate.h" + +#include "atom/common/platform_util.h" +#include "content/public/browser/browser_thread.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/render_view_host.h" +#include "net/base/escape.h" + +using content::BrowserThread; + +namespace atom { + +namespace { + +void HandleExternalProtocolInUI(const GURL& url, + int render_process_id, + int render_view_id) { + auto web_contents = content::WebContents::FromRenderViewHost( + content::RenderViewHost::FromID(render_process_id, render_view_id)); + if (!web_contents) + return; + + GURL escaped_url(net::EscapeExternalHandlerValue(url.spec())); + platform_util::OpenExternal(escaped_url); +} + +} // namespace + +AtomResourceDispatcherHostDelegate::AtomResourceDispatcherHostDelegate() { +} + +AtomResourceDispatcherHostDelegate::~AtomResourceDispatcherHostDelegate() { +} + +bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol( + const GURL& url, + int render_process_id, + int render_view_id, + bool is_main_frame, + ui::PageTransition transition, + bool has_user_gesture) { + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, + base::Bind(&HandleExternalProtocolInUI, + url, + render_process_id, + render_view_id)); + return true; +} + +} // namespace atom diff --git a/atom/browser/atom_browser_resource_dispatcher_host_delegate.h b/atom/browser/atom_browser_resource_dispatcher_host_delegate.h new file mode 100644 index 0000000000..21155024c8 --- /dev/null +++ b/atom/browser/atom_browser_resource_dispatcher_host_delegate.h @@ -0,0 +1,29 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#ifndef ATOM_BROWSER_ATOM_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ +#define ATOM_BROWSER_ATOM_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ + +#include "content/public/browser/resource_dispatcher_host_delegate.h" + +namespace atom { + +class AtomResourceDispatcherHostDelegate + : public content::ResourceDispatcherHostDelegate { + public: + AtomResourceDispatcherHostDelegate(); + ~AtomResourceDispatcherHostDelegate(); + + // content::ResourceDispatcherHostDelegate: + bool HandleExternalProtocol(const GURL& url, + int render_process_id, + int render_view_id, + bool is_main_frame, + ui::PageTransition transition, + bool has_user_gesture) override; +}; + +} // namespace atom + +#endif // ATOM_BROWSER_ATOM_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ diff --git a/filenames.gypi b/filenames.gypi index cb6a2273ea..a571ed1caf 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -125,6 +125,8 @@ 'atom/browser/atom_browser_main_parts.h', 'atom/browser/atom_browser_main_parts_linux.cc', 'atom/browser/atom_browser_main_parts_mac.mm', + 'atom/browser/atom_browser_resource_dispatcher_host_delegate.cc', + 'atom/browser/atom_browser_resource_dispatcher_host_delegate.h', 'atom/browser/atom_javascript_dialog_manager.cc', 'atom/browser/atom_javascript_dialog_manager.h', 'atom/browser/atom_quota_permission_context.cc', From 93f58925aa2b6e0bef2143f2ca2b8122c31f17bc Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Wed, 30 Sep 2015 10:54:18 +0900 Subject: [PATCH 18/65] Improve grammar --- docs-translations/ko-KR/tutorial/quick-start.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs-translations/ko-KR/tutorial/quick-start.md b/docs-translations/ko-KR/tutorial/quick-start.md index 4a6ce6d225..3edf13cc47 100644 --- a/docs-translations/ko-KR/tutorial/quick-start.md +++ b/docs-translations/ko-KR/tutorial/quick-start.md @@ -127,31 +127,31 @@ app.on('ready', function() { 앱을 작성한 후 [어플리케이션 배포](application-distribution.md) 가이드를 따라 앱을 패키징 하고 패키징한 앱을 실행할 수 있습니다. 또한 Electron 실행파일을 다운로드 받아 바로 실행해 볼 수도 있습니다. -### electron-prebuilt +### electron-prebuilt 사용 `npm`을 통해 `electron-prebuilt` 패키지를 전역에 설치하면 간단한 명령으로 앱을 실행할 수 있습니다. -앱 디렉터리 내에서 이렇게 실행합니다: +앱 디렉터리 내에서 다음 명령으로 실행할 수 있습니다: ```bash electron . ``` -또는 앱 디렉터리 밖에서 앱 디렉터리를 입력해도 됩니다: +또는 앱 디렉터리 밖에서 앱을 실행할 수도 있습니다: ```bash electron app ``` -npm 모듈을 로컬에 설치했다면 이렇게 실행할 수 있습니다: +npm 모듈을 로컬에 설치했다면 다음 명령으로 실행할 수 있습니다: ```bash ./node_modules/.bin/electron . ``` -### 임의로 다운로드 받은 Electron +### 다운로드 받은 Electron 바이너리 사용 -만약 Electron 바이너리를 임의로 다운로드 받았다면 다음과 같이 앱 디렉터리에 놓고 실행하면 됩니다. +따로 Electron 바이너리를 다운로드 받았다면 다음 예시와 같이 실행하면 됩니다. #### Windows From 21f7316a18dd62a6753b99953ca97fdc9106faea Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 30 Sep 2015 10:56:42 +0800 Subject: [PATCH 19/65] Code cleanup --- atom/browser/atom_browser_client.cc | 2 +- ...owser_resource_dispatcher_host_delegate.cc | 54 ------------------- .../atom_resource_dispatcher_host_delegate.cc | 32 +++++++++++ ... atom_resource_dispatcher_host_delegate.h} | 7 ++- filenames.gypi | 4 +- 5 files changed, 38 insertions(+), 61 deletions(-) delete mode 100644 atom/browser/atom_browser_resource_dispatcher_host_delegate.cc create mode 100644 atom/browser/atom_resource_dispatcher_host_delegate.cc rename atom/browser/{atom_browser_resource_dispatcher_host_delegate.h => atom_resource_dispatcher_host_delegate.h} (74%) diff --git a/atom/browser/atom_browser_client.cc b/atom/browser/atom_browser_client.cc index dface840d7..4969ce47a6 100644 --- a/atom/browser/atom_browser_client.cc +++ b/atom/browser/atom_browser_client.cc @@ -11,8 +11,8 @@ #include "atom/browser/atom_access_token_store.h" #include "atom/browser/atom_browser_context.h" #include "atom/browser/atom_browser_main_parts.h" -#include "atom/browser/atom_browser_resource_dispatcher_host_delegate.h" #include "atom/browser/atom_quota_permission_context.h" +#include "atom/browser/atom_resource_dispatcher_host_delegate.h" #include "atom/browser/atom_speech_recognition_manager_delegate.h" #include "atom/browser/browser.h" #include "atom/browser/native_window.h" diff --git a/atom/browser/atom_browser_resource_dispatcher_host_delegate.cc b/atom/browser/atom_browser_resource_dispatcher_host_delegate.cc deleted file mode 100644 index 9e02f7cc81..0000000000 --- a/atom/browser/atom_browser_resource_dispatcher_host_delegate.cc +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) 2015 GitHub, Inc. -// Use of this source code is governed by the MIT license that can be -// found in the LICENSE file. - -#include "atom/browser/atom_browser_resource_dispatcher_host_delegate.h" - -#include "atom/common/platform_util.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/web_contents.h" -#include "content/public/browser/render_view_host.h" -#include "net/base/escape.h" - -using content::BrowserThread; - -namespace atom { - -namespace { - -void HandleExternalProtocolInUI(const GURL& url, - int render_process_id, - int render_view_id) { - auto web_contents = content::WebContents::FromRenderViewHost( - content::RenderViewHost::FromID(render_process_id, render_view_id)); - if (!web_contents) - return; - - GURL escaped_url(net::EscapeExternalHandlerValue(url.spec())); - platform_util::OpenExternal(escaped_url); -} - -} // namespace - -AtomResourceDispatcherHostDelegate::AtomResourceDispatcherHostDelegate() { -} - -AtomResourceDispatcherHostDelegate::~AtomResourceDispatcherHostDelegate() { -} - -bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol( - const GURL& url, - int render_process_id, - int render_view_id, - bool is_main_frame, - ui::PageTransition transition, - bool has_user_gesture) { - BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(&HandleExternalProtocolInUI, - url, - render_process_id, - render_view_id)); - return true; -} - -} // namespace atom diff --git a/atom/browser/atom_resource_dispatcher_host_delegate.cc b/atom/browser/atom_resource_dispatcher_host_delegate.cc new file mode 100644 index 0000000000..46904d2ff9 --- /dev/null +++ b/atom/browser/atom_resource_dispatcher_host_delegate.cc @@ -0,0 +1,32 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +#include "atom/browser/atom_resource_dispatcher_host_delegate.h" + +#include "atom/common/platform_util.h" +#include "content/public/browser/browser_thread.h" +#include "net/base/escape.h" +#include "url/gurl.h" + +using content::BrowserThread; + +namespace atom { + +AtomResourceDispatcherHostDelegate::AtomResourceDispatcherHostDelegate() { +} + +bool AtomResourceDispatcherHostDelegate::HandleExternalProtocol( + const GURL& url, + int render_process_id, + int render_view_id, + bool is_main_frame, + ui::PageTransition transition, + bool has_user_gesture) { + GURL escaped_url(net::EscapeExternalHandlerValue(url.spec())); + BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, + base::Bind(base::IgnoreResult(platform_util::OpenExternal), escaped_url)); + return true; +} + +} // namespace atom diff --git a/atom/browser/atom_browser_resource_dispatcher_host_delegate.h b/atom/browser/atom_resource_dispatcher_host_delegate.h similarity index 74% rename from atom/browser/atom_browser_resource_dispatcher_host_delegate.h rename to atom/browser/atom_resource_dispatcher_host_delegate.h index 21155024c8..876554f0f9 100644 --- a/atom/browser/atom_browser_resource_dispatcher_host_delegate.h +++ b/atom/browser/atom_resource_dispatcher_host_delegate.h @@ -2,8 +2,8 @@ // Use of this source code is governed by the MIT license that can be // found in the LICENSE file. -#ifndef ATOM_BROWSER_ATOM_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ -#define ATOM_BROWSER_ATOM_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ +#ifndef ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ +#define ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ #include "content/public/browser/resource_dispatcher_host_delegate.h" @@ -13,7 +13,6 @@ class AtomResourceDispatcherHostDelegate : public content::ResourceDispatcherHostDelegate { public: AtomResourceDispatcherHostDelegate(); - ~AtomResourceDispatcherHostDelegate(); // content::ResourceDispatcherHostDelegate: bool HandleExternalProtocol(const GURL& url, @@ -26,4 +25,4 @@ class AtomResourceDispatcherHostDelegate } // namespace atom -#endif // ATOM_BROWSER_ATOM_BROWSER_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ +#endif // ATOM_BROWSER_ATOM_RESOURCE_DISPATCHER_HOST_DELEGATE_H_ diff --git a/filenames.gypi b/filenames.gypi index a571ed1caf..0e7010d7a4 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -125,12 +125,12 @@ 'atom/browser/atom_browser_main_parts.h', 'atom/browser/atom_browser_main_parts_linux.cc', 'atom/browser/atom_browser_main_parts_mac.mm', - 'atom/browser/atom_browser_resource_dispatcher_host_delegate.cc', - 'atom/browser/atom_browser_resource_dispatcher_host_delegate.h', 'atom/browser/atom_javascript_dialog_manager.cc', 'atom/browser/atom_javascript_dialog_manager.h', 'atom/browser/atom_quota_permission_context.cc', 'atom/browser/atom_quota_permission_context.h', + 'atom/browser/atom_resource_dispatcher_host_delegate.cc', + 'atom/browser/atom_resource_dispatcher_host_delegate.h', 'atom/browser/atom_speech_recognition_manager_delegate.cc', 'atom/browser/atom_speech_recognition_manager_delegate.h', 'atom/browser/atom_ssl_config_service.cc', From 4fdf6ceb5170c8146a1eb37559bf7a766d803ec3 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 30 Sep 2015 16:58:37 +0800 Subject: [PATCH 20/65] Cache remote WebContents object of webview --- atom/renderer/lib/web-view/web-view.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/atom/renderer/lib/web-view/web-view.coffee b/atom/renderer/lib/web-view/web-view.coffee index 65e4501975..3a563101f0 100644 --- a/atom/renderer/lib/web-view/web-view.coffee +++ b/atom/renderer/lib/web-view/web-view.coffee @@ -46,6 +46,7 @@ class WebViewImpl # that we don't end up allocating a second guest. if @guestInstanceId guestViewInternal.destroyGuest @guestInstanceId + @webContents = null @guestInstanceId = undefined @beforeFirstNavigation = true @attributes[webViewConstants.ATTRIBUTE_PARTITION].validPartitionId = true @@ -188,6 +189,7 @@ class WebViewImpl attachWindow: (guestInstanceId) -> @guestInstanceId = guestInstanceId + @webContents = remote.getGuestWebContents @guestInstanceId return true unless @internalInstanceId guestViewInternal.attachGuest @internalInstanceId, @guestInstanceId, @buildParams() @@ -299,7 +301,7 @@ registerWebViewElement = -> createHandler = (m) -> (args...) -> internal = v8Util.getHiddenValue this, 'internal' - remote.getGuestWebContents(internal.guestInstanceId)[m] args... + internal.webContents[m] args... proto[m] = createHandler m for m in methods window.WebView = webFrame.registerEmbedderCustomElement 'webview', From 8c3116851dcdc2eee5be766a1f889d48a88ddab2 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 30 Sep 2015 17:29:38 +0800 Subject: [PATCH 21/65] Exit the process when unable to find a valid app Fixes #2583. --- atom/browser/lib/init.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/atom/browser/lib/init.coffee b/atom/browser/lib/init.coffee index 1299364d2f..454baf0b8a 100644 --- a/atom/browser/lib/init.coffee +++ b/atom/browser/lib/init.coffee @@ -64,7 +64,9 @@ for packagePath in searchPaths catch e continue -throw new Error("Unable to find a valid app") unless packageJson? +unless packageJson? + process.nextTick -> process.exit 1 + throw new Error("Unable to find a valid app") # Set application's version. app.setVersion packageJson.version if packageJson.version? From d5f81357b60092edee2694975cb646651f695220 Mon Sep 17 00:00:00 2001 From: Alexander Rusakov Date: Wed, 30 Sep 2015 17:13:20 +0300 Subject: [PATCH 22/65] remove required width and height BrowserWindowOptions --- docs/api/browser-window.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index a1870bc66a..c71cb610fc 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -24,14 +24,13 @@ You can also create a window without chrome by using [EventEmitter](http://nodejs.org/api/events.html#events_class_events_eventemitter). It creates a new `BrowserWindow` with native properties as set by the `options`. -Properties `width` and `height` are required. ### `new BrowserWindow(options)` `options` Object, properties: -* `width` Integer (**required**) - Window's width. -* `height` Integer (**required**) - Window's height. +* `width` Integer - Window's width. +* `height` Integer - Window's height. * `x` Integer - Window's left offset from screen. * `y` Integer - Window's top offset from screen. * `use-content-size` Boolean - The `width` and `height` would be used as web From 0fb68e8130841282d7e605d165c9d1ced84ff103 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 30 Sep 2015 23:41:23 +0800 Subject: [PATCH 23/65] Make Menu.popup accept no parameter --- atom/browser/api/lib/menu.coffee | 6 +++++- docs/api/menu.md | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/atom/browser/api/lib/menu.coffee b/atom/browser/api/lib/menu.coffee index 3595ba1fe7..f66c1568c0 100644 --- a/atom/browser/api/lib/menu.coffee +++ b/atom/browser/api/lib/menu.coffee @@ -79,7 +79,11 @@ Menu::_init = -> v8Util.setHiddenValue group[0], 'checked', true unless checked Menu::popup = (window, x, y) -> - throw new TypeError('Invalid window') unless window?.constructor is BrowserWindow + unless window?.constructor is BrowserWindow + # Shift. + y = x + x = window + window = BrowserWindow.getFocusedWindow() if x? and y? @_popupAt(window, x, y) else diff --git a/docs/api/menu.md b/docs/api/menu.md index f48b07e7e4..cabd04ca85 100644 --- a/docs/api/menu.md +++ b/docs/api/menu.md @@ -237,9 +237,9 @@ Generally, the `template` is just an array of `options` for constructing a You can also attach other fields to the element of the `template` and they will become properties of the constructed menu items. -### `Menu.popup(browserWindow[, x, y])` +### `Menu.popup([browserWindow, x, y])` -* `browserWindow` BrowserWindow +* `browserWindow` BrowserWindow (optional) * `x` Number (optional) * `y` Number (**required** if `x` is used) From 83c514001ef3b7fb0cd82f7ddcef8ad704e717c7 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 1 Oct 2015 11:14:19 +0800 Subject: [PATCH 24/65] Move devtools API to WebContents --- atom/browser/api/atom_api_web_contents.cc | 44 +++++++++++++++++--- atom/browser/api/atom_api_web_contents.h | 11 ++++- atom/browser/api/atom_api_window.cc | 32 +------------- atom/browser/api/atom_api_window.h | 5 --- atom/browser/api/lib/browser-window.coffee | 9 ++++ atom/browser/common_web_contents_delegate.cc | 25 +++++++++++ atom/browser/common_web_contents_delegate.h | 13 +++++- atom/browser/native_window.cc | 14 ------- atom/browser/native_window.h | 9 +--- atom/browser/native_window_observer.h | 5 --- atom/browser/native_window_views.cc | 12 ------ atom/browser/native_window_views.h | 7 ---- 12 files changed, 97 insertions(+), 89 deletions(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index bdeb4ed4f8..90c5a5146c 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -26,6 +26,7 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "brightray/browser/inspectable_web_contents.h" +#include "brightray/browser/inspectable_web_contents_view.h" #include "chrome/browser/printing/print_view_manager_basic.h" #include "chrome/browser/printing/print_preview_message_handler.h" #include "content/common/view_messages.h" @@ -228,6 +229,8 @@ WebContents::WebContents(v8::Isolate* isolate, AttachAsUserData(web_contents); InitWithWebContents(web_contents); + managed_web_contents()->GetView()->SetDelegate(this); + // Save the preferences in C++. base::DictionaryValue web_preferences; mate::ConvertFromV8(isolate, options.GetHandle(), &web_preferences); @@ -491,6 +494,28 @@ void WebContents::DidUpdateFaviconURL( Emit("page-favicon-updated", unique_urls); } +void WebContents::DevToolsFocused() { + Emit("devtools-focused"); +} + +void WebContents::DevToolsOpened() { + v8::Locker locker(isolate()); + v8::HandleScope handle_scope(isolate()); + auto handle = WebContents::CreateFrom( + isolate(), managed_web_contents()->GetDevToolsWebContents()); + devtools_web_contents_.Reset(isolate(), handle.ToV8()); + + Emit("devtools-opened"); +} + +void WebContents::DevToolsClosed() { + v8::Locker locker(isolate()); + v8::HandleScope handle_scope(isolate()); + devtools_web_contents_.Reset(); + + Emit("devtools-closed"); +} + bool WebContents::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebContents, message) @@ -698,10 +723,6 @@ void WebContents::InspectServiceWorker() { } } -v8::Local WebContents::Session(v8::Isolate* isolate) { - return v8::Local::New(isolate, session_); -} - void WebContents::HasServiceWorker( const base::Callback& callback) { auto context = GetServiceWorkerContext(web_contents()); @@ -893,6 +914,17 @@ v8::Local WebContents::GetWebPreferences(v8::Isolate* isolate) { return mate::ConvertToV8(isolate, *web_preferences->web_preferences()); } +v8::Local WebContents::Session(v8::Isolate* isolate) { + return v8::Local::New(isolate, session_); +} + +v8::Local WebContents::DevToolsWebContents(v8::Isolate* isolate) { + if (devtools_web_contents_.IsEmpty()) + return v8::Null(isolate); + else + return v8::Local::New(isolate, devtools_web_contents_); +} + mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder( v8::Isolate* isolate) { if (template_.IsEmpty()) @@ -957,7 +989,9 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder( .SetMethod("_printToPDF", &WebContents::PrintToPDF) .SetMethod("addWorkSpace", &WebContents::AddWorkSpace) .SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace) - .SetProperty("session", &WebContents::Session) + .SetProperty("session", &WebContents::Session, true) + .SetProperty("devToolsWebContents", + &WebContents::DevToolsWebContents, true) .Build()); return mate::ObjectTemplateBuilder( diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 91750ac613..fa32d812e6 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -83,7 +83,6 @@ class WebContents : public mate::TrackableObject, void DisableDeviceEmulation(); void InspectElement(int x, int y); void InspectServiceWorker(); - v8::Local Session(v8::Isolate* isolate); void HasServiceWorker(const base::Callback&); void UnregisterServiceWorker(const base::Callback&); void SetAudioMuted(bool muted); @@ -135,6 +134,10 @@ class WebContents : public mate::TrackableObject, // Returns the web preferences of current WebContents. v8::Local GetWebPreferences(v8::Isolate* isolate); + // Properties. + v8::Local Session(v8::Isolate* isolate); + v8::Local DevToolsWebContents(v8::Isolate* isolate); + protected: explicit WebContents(content::WebContents* web_contents); WebContents(v8::Isolate* isolate, const mate::Dictionary& options); @@ -218,6 +221,11 @@ class WebContents : public mate::TrackableObject, void PluginCrashed(const base::FilePath& plugin_path, base::ProcessId plugin_pid) override; + // brightray::InspectableWebContentsViewDelegate: + void DevToolsFocused() override; + void DevToolsOpened() override; + void DevToolsClosed() override; + private: enum Type { BROWSER_WINDOW, // Used by BrowserWindow. @@ -237,6 +245,7 @@ class WebContents : public mate::TrackableObject, IPC::Message* message); v8::Global session_; + v8::Global devtools_web_contents_; scoped_ptr guest_delegate_; diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 4d866d1850..7536c70876 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -184,28 +184,6 @@ void Window::OnRendererResponsive() { Emit("responsive"); } -void Window::OnDevToolsFocus() { - Emit("devtools-focused"); -} - -void Window::OnDevToolsOpened() { - v8::Locker locker(isolate()); - v8::HandleScope handle_scope(isolate()); - auto handle = WebContents::CreateFrom( - isolate(), api_web_contents_->GetDevToolsWebContents()); - devtools_web_contents_.Reset(isolate(), handle.ToV8()); - - Emit("devtools-opened"); -} - -void Window::OnDevToolsClosed() { - v8::Locker locker(isolate()); - v8::HandleScope handle_scope(isolate()); - devtools_web_contents_.Reset(); - - Emit("devtools-closed"); -} - void Window::OnExecuteWindowsCommand(const std::string& command_name) { Emit("app-command", command_name); } @@ -540,13 +518,6 @@ v8::Local Window::WebContents(v8::Isolate* isolate) { return v8::Local::New(isolate, web_contents_); } -v8::Local Window::DevToolsWebContents(v8::Isolate* isolate) { - if (devtools_web_contents_.IsEmpty()) - return v8::Null(isolate); - else - return v8::Local::New(isolate, devtools_web_contents_); -} - // static void Window::BuildPrototype(v8::Isolate* isolate, v8::Local prototype) { @@ -618,8 +589,7 @@ void Window::BuildPrototype(v8::Isolate* isolate, &Window::ShowDefinitionForSelection) #endif .SetProperty("id", &Window::ID, true) - .SetProperty("webContents", &Window::WebContents, true) - .SetProperty("devToolsWebContents", &Window::DevToolsWebContents, true); + .SetProperty("webContents", &Window::WebContents, true); } } // namespace api diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index d60bf0d87e..8cf26fe58e 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -69,9 +69,6 @@ class Window : public mate::TrackableObject, void OnWindowLeaveHtmlFullScreen() override; void OnRendererUnresponsive() override; void OnRendererResponsive() override; - void OnDevToolsFocus() override; - void OnDevToolsOpened() override; - void OnDevToolsClosed() override; void OnExecuteWindowsCommand(const std::string& command_name) override; // mate::Wrappable: @@ -150,10 +147,8 @@ class Window : public mate::TrackableObject, int32_t ID() const; v8::Local WebContents(v8::Isolate* isolate); - v8::Local DevToolsWebContents(v8::Isolate* isolate); v8::Global web_contents_; - v8::Global devtools_web_contents_; v8::Global menu_; api::WebContents* api_web_contents_; diff --git a/atom/browser/api/lib/browser-window.coffee b/atom/browser/api/lib/browser-window.coffee index 2a92cfc55f..6ffba50d34 100644 --- a/atom/browser/api/lib/browser-window.coffee +++ b/atom/browser/api/lib/browser-window.coffee @@ -48,6 +48,15 @@ BrowserWindow::_init = -> # Notify the creation of the window. app.emit 'browser-window-created', {}, this + # Be compatible with old APIs. + @webContents.on 'devtools-focused', => @emit 'devtools-focused' + @webContents.on 'devtools-opened', => @emit 'devtools-opened' + @webContents.on 'devtools-closed', => @emit 'devtools-closed' + Object.defineProperty this, 'devToolsWebContents', + enumerable: true, + configurable: false, + get: -> @webContents.devToolsWebContents + BrowserWindow.getFocusedWindow = -> windows = BrowserWindow.getAllWindows() return window for window in windows when window.isFocused() diff --git a/atom/browser/common_web_contents_delegate.cc b/atom/browser/common_web_contents_delegate.cc index 3cef7c6d68..518d4f650a 100644 --- a/atom/browser/common_web_contents_delegate.cc +++ b/atom/browser/common_web_contents_delegate.cc @@ -21,6 +21,14 @@ #include "content/public/browser/render_view_host.h" #include "storage/browser/fileapi/isolated_context.h" +#if defined(TOOLKIT_VIEWS) +#include "atom/browser/native_window_views.h" +#endif + +#if defined(USE_X11) +#include "atom/browser/browser.h" +#endif + using content::BrowserThread; namespace atom { @@ -355,6 +363,23 @@ void CommonWebContentsDelegate::OnDevToolsAppendToFile( "DevToolsAPI.appendedToURL", &url_value, nullptr, nullptr); } +#if defined(TOOLKIT_VIEWS) +gfx::ImageSkia CommonWebContentsDelegate::GetDevToolsWindowIcon() { + if (!owner_window()) + return gfx::ImageSkia(); + return static_cast(static_cast( + owner_window()))->GetWindowAppIcon(); +} +#endif + +#if defined(USE_X11) +void CommonWebContentsDelegate::GetDevToolsWindowWMClass( + std::string* name, std::string* class_name) { + *class_name = Browser::Get()->GetName(); + *name = base::StringToLowerASCII(*class_name); +} +#endif + void CommonWebContentsDelegate::SetHtmlApiFullscreen(bool enter_fullscreen) { // Window is already in fullscreen mode, save the state. if (enter_fullscreen && owner_window_->IsFullscreen()) { diff --git a/atom/browser/common_web_contents_delegate.h b/atom/browser/common_web_contents_delegate.h index 495b5501a0..3a5be180dc 100644 --- a/atom/browser/common_web_contents_delegate.h +++ b/atom/browser/common_web_contents_delegate.h @@ -12,6 +12,7 @@ #include "brightray/browser/default_web_contents_delegate.h" #include "brightray/browser/inspectable_web_contents_impl.h" #include "brightray/browser/inspectable_web_contents_delegate.h" +#include "brightray/browser/inspectable_web_contents_view_delegate.h" namespace atom { @@ -21,7 +22,8 @@ class WebDialogHelper; class CommonWebContentsDelegate : public brightray::DefaultWebContentsDelegate, - public brightray::InspectableWebContentsDelegate { + public brightray::InspectableWebContentsDelegate, + public brightray::InspectableWebContentsViewDelegate { public: CommonWebContentsDelegate(); virtual ~CommonWebContentsDelegate(); @@ -86,6 +88,15 @@ class CommonWebContentsDelegate void DevToolsRemoveFileSystem( const base::FilePath& file_system_path) override; + // brightray::InspectableWebContentsViewDelegate: +#if defined(TOOLKIT_VIEWS) + gfx::ImageSkia GetDevToolsWindowIcon() override; +#endif +#if defined(USE_X11) + void GetDevToolsWindowWMClass( + std::string* name, std::string* class_name) override; +#endif + private: // Callback for when DevToolsSaveToFile has completed. void OnDevToolsSaveToFile(const std::string& url); diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index c3620bba70..b3ac71d210 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -76,8 +76,6 @@ NativeWindow::NativeWindow( aspect_ratio_(0.0), inspectable_web_contents_(inspectable_web_contents), weak_factory_(this) { - inspectable_web_contents->GetView()->SetDelegate(this); - options.Get(switches::kFrame, &has_frame_); options.Get(switches::kTransparent, &transparent_); options.Get(switches::kEnableLargerThanScreen, &enable_larger_than_screen_); @@ -418,18 +416,6 @@ void NativeWindow::NotifyWindowExecuteWindowsCommand( OnExecuteWindowsCommand(command)); } -void NativeWindow::DevToolsFocused() { - FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnDevToolsFocus()); -} - -void NativeWindow::DevToolsOpened() { - FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnDevToolsOpened()); -} - -void NativeWindow::DevToolsClosed() { - FOR_EACH_OBSERVER(NativeWindowObserver, observers_, OnDevToolsClosed()); -} - void NativeWindow::RenderViewCreated( content::RenderViewHost* render_view_host) { if (!transparent_) diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index 5c8d8c73b0..6350ad247c 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -15,7 +15,6 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "brightray/browser/inspectable_web_contents_view_delegate.h" #include "content/public/browser/readback_types.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" @@ -50,8 +49,7 @@ namespace atom { struct DraggableRegion; -class NativeWindow : public content::WebContentsObserver, - public brightray::InspectableWebContentsViewDelegate { +class NativeWindow : public content::WebContentsObserver { public: using CapturePageCallback = base::Callback; @@ -234,11 +232,6 @@ class NativeWindow : public content::WebContentsObserver, NativeWindow(brightray::InspectableWebContents* inspectable_web_contents, const mate::Dictionary& options); - // brightray::InspectableWebContentsViewDelegate: - void DevToolsFocused() override; - void DevToolsOpened() override; - void DevToolsClosed() override; - // content::WebContentsObserver: void RenderViewCreated(content::RenderViewHost* render_view_host) override; void BeforeUnloadDialogCancelled() override; diff --git a/atom/browser/native_window_observer.h b/atom/browser/native_window_observer.h index 5b0a0c56b3..33ab1ecb6b 100644 --- a/atom/browser/native_window_observer.h +++ b/atom/browser/native_window_observer.h @@ -55,11 +55,6 @@ class NativeWindowObserver { virtual void OnWindowEnterHtmlFullScreen() {} virtual void OnWindowLeaveHtmlFullScreen() {} - // Redirect devtools events. - virtual void OnDevToolsFocus() {} - virtual void OnDevToolsOpened() {} - virtual void OnDevToolsClosed() {} - // Called when renderer is hung. virtual void OnRendererUnresponsive() {} diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 34c2f62263..0fa2a99c27 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -823,18 +823,6 @@ bool NativeWindowViews::ExecuteWindowsCommand(int command_id) { } #endif -gfx::ImageSkia NativeWindowViews::GetDevToolsWindowIcon() { - return GetWindowAppIcon(); -} - -#if defined(USE_X11) -void NativeWindowViews::GetDevToolsWindowWMClass( - std::string* name, std::string* class_name) { - *class_name = Browser::Get()->GetName(); - *name = base::StringToLowerASCII(*class_name); -} -#endif - #if defined(OS_WIN) bool NativeWindowViews::PreHandleMSG( UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) { diff --git a/atom/browser/native_window_views.h b/atom/browser/native_window_views.h index 70c722c7d9..71e122d381 100644 --- a/atom/browser/native_window_views.h +++ b/atom/browser/native_window_views.h @@ -131,13 +131,6 @@ class NativeWindowViews : public NativeWindow, bool ExecuteWindowsCommand(int command_id) override; #endif - // brightray::InspectableWebContentsViewDelegate: - gfx::ImageSkia GetDevToolsWindowIcon() override; -#if defined(USE_X11) - void GetDevToolsWindowWMClass( - std::string* name, std::string* class_name) override; -#endif - #if defined(OS_WIN) // MessageHandlerDelegate: bool PreHandleMSG( From f2c7943d42eb83ca81c73c619ac9e727744b8967 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 1 Oct 2015 13:45:59 +0800 Subject: [PATCH 25/65] Add WebContents.getOwnerBrowserWindow --- atom/browser/api/atom_api_web_contents.cc | 9 +++++++++ atom/browser/api/atom_api_web_contents.h | 3 +++ atom/browser/api/atom_api_window.cc | 11 +++++++++++ atom/browser/api/atom_api_window.h | 4 ++++ atom/browser/native_window.h | 4 +++- 5 files changed, 30 insertions(+), 1 deletion(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 90c5a5146c..bbe244da7e 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -7,6 +7,7 @@ #include #include "atom/browser/api/atom_api_session.h" +#include "atom/browser/api/atom_api_window.h" #include "atom/browser/atom_browser_client.h" #include "atom/browser/atom_browser_context.h" #include "atom/browser/atom_browser_main_parts.h" @@ -914,6 +915,13 @@ v8::Local WebContents::GetWebPreferences(v8::Isolate* isolate) { return mate::ConvertToV8(isolate, *web_preferences->web_preferences()); } +v8::Local WebContents::GetOwnerBrowserWindow() { + if (owner_window()) + return Window::From(isolate(), owner_window()); + else + return v8::Null(isolate()); +} + v8::Local WebContents::Session(v8::Isolate* isolate) { return v8::Local::New(isolate, session_); } @@ -981,6 +989,7 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder( .SetMethod("setAllowTransparency", &WebContents::SetAllowTransparency) .SetMethod("isGuest", &WebContents::IsGuest) .SetMethod("getWebPreferences", &WebContents::GetWebPreferences) + .SetMethod("getOwnerBrowserWindow", &WebContents::GetOwnerBrowserWindow) .SetMethod("hasServiceWorker", &WebContents::HasServiceWorker) .SetMethod("unregisterServiceWorker", &WebContents::UnregisterServiceWorker) diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index fa32d812e6..bbf331848c 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -134,6 +134,9 @@ class WebContents : public mate::TrackableObject, // Returns the web preferences of current WebContents. v8::Local GetWebPreferences(v8::Isolate* isolate); + // Returns the owner window. + v8::Local GetOwnerBrowserWindow(); + // Properties. v8::Local Session(v8::Isolate* isolate); v8::Local DevToolsWebContents(v8::Isolate* isolate); diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 7536c70876..c4beaace67 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -92,6 +92,7 @@ Window::Window(v8::Isolate* isolate, const mate::Dictionary& options) { web_contents->SetOwnerWindow(window_.get()); window_->InitFromOptions(options); window_->AddObserver(this); + AttachAsUserData(window_.get()); } Window::~Window() { @@ -592,6 +593,16 @@ void Window::BuildPrototype(v8::Isolate* isolate, .SetProperty("webContents", &Window::WebContents, true); } +// static +v8::Local Window::From(v8::Isolate* isolate, + NativeWindow* native_window) { + auto existing = TrackableObject::FromWrappedClass(isolate, native_window); + if (existing) + return existing->GetWrapper(isolate); + else + return v8::Null(isolate); +} + } // namespace api } // namespace atom diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index 8cf26fe58e..d2886b5fac 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -43,6 +43,10 @@ class Window : public mate::TrackableObject, static void BuildPrototype(v8::Isolate* isolate, v8::Local prototype); + // Returns the BrowserWindow object from |native_window|. + static v8::Local From(v8::Isolate* isolate, + NativeWindow* native_window); + NativeWindow* window() const { return window_.get(); } protected: diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index 6350ad247c..751644e459 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -15,6 +15,7 @@ #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" +#include "base/supports_user_data.h" #include "content/public/browser/readback_types.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" @@ -49,7 +50,8 @@ namespace atom { struct DraggableRegion; -class NativeWindow : public content::WebContentsObserver { +class NativeWindow : public base::SupportsUserData, + public content::WebContentsObserver { public: using CapturePageCallback = base::Callback; From 1045bbc861186a566f0d9ed2b4768a7fda23be3f Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 1 Oct 2015 14:08:33 +0800 Subject: [PATCH 26/65] Do not enumerate windows in remote.getCurrentWindow --- atom/browser/lib/rpc-server.coffee | 11 ++--------- atom/renderer/api/lib/remote.coffee | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/atom/browser/lib/rpc-server.coffee b/atom/browser/lib/rpc-server.coffee index 0a28d350e8..149b208b40 100644 --- a/atom/browser/lib/rpc-server.coffee +++ b/atom/browser/lib/rpc-server.coffee @@ -106,16 +106,9 @@ ipc.on 'ATOM_BROWSER_GLOBAL', (event, name) -> catch e event.returnValue = errorToMeta e -ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event, guestInstanceId) -> +ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event) -> try - BrowserWindow = require 'browser-window' - if guestInstanceId? - guestViewManager = require './guest-view-manager' - window = BrowserWindow.fromWebContents guestViewManager.getEmbedder(guestInstanceId) - else - window = BrowserWindow.fromWebContents event.sender - window = BrowserWindow.fromDevToolsWebContents event.sender unless window? - event.returnValue = valueToMeta event.sender, window + event.returnValue = valueToMeta event.sender, event.sender.getOwnerBrowserWindow() catch e event.returnValue = errorToMeta e diff --git a/atom/renderer/api/lib/remote.coffee b/atom/renderer/api/lib/remote.coffee index 00d22ab8cf..1f17cf3400 100644 --- a/atom/renderer/api/lib/remote.coffee +++ b/atom/renderer/api/lib/remote.coffee @@ -130,7 +130,7 @@ exports.require = (module) -> windowCache = null exports.getCurrentWindow = -> return windowCache if windowCache? - meta = ipc.sendSync 'ATOM_BROWSER_CURRENT_WINDOW', process.guestInstanceId + meta = ipc.sendSync 'ATOM_BROWSER_CURRENT_WINDOW' windowCache = metaToValue meta # Get current WebContents object. From ca40ea8e2fc179668b8d9c8b429a94cb0f740781 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 1 Oct 2015 14:41:01 +0800 Subject: [PATCH 27/65] Inherit owner window in devtools --- atom/browser/api/atom_api_web_contents.cc | 5 +++++ atom/browser/common_web_contents_delegate.cc | 6 +++++- atom/browser/common_web_contents_delegate.h | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index bbe244da7e..f6433ca635 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -506,6 +506,11 @@ void WebContents::DevToolsOpened() { isolate(), managed_web_contents()->GetDevToolsWebContents()); devtools_web_contents_.Reset(isolate(), handle.ToV8()); + // Inherit owner window in devtools. + if (owner_window()) + handle->SetOwnerWindow(managed_web_contents()->GetDevToolsWebContents(), + owner_window()); + Emit("devtools-opened"); } diff --git a/atom/browser/common_web_contents_delegate.cc b/atom/browser/common_web_contents_delegate.cc index 518d4f650a..8b7a159dd7 100644 --- a/atom/browser/common_web_contents_delegate.cc +++ b/atom/browser/common_web_contents_delegate.cc @@ -136,7 +136,11 @@ void CommonWebContentsDelegate::InitWithWebContents( } void CommonWebContentsDelegate::SetOwnerWindow(NativeWindow* owner_window) { - content::WebContents* web_contents = GetWebContents(); + SetOwnerWindow(GetWebContents(), owner_window); +} + +void CommonWebContentsDelegate::SetOwnerWindow( + content::WebContents* web_contents, NativeWindow* owner_window) { owner_window_ = owner_window->GetWeakPtr(); NativeWindowRelay* relay = new NativeWindowRelay(owner_window_); web_contents->SetUserData(relay->key, relay); diff --git a/atom/browser/common_web_contents_delegate.h b/atom/browser/common_web_contents_delegate.h index 3a5be180dc..ee18f36660 100644 --- a/atom/browser/common_web_contents_delegate.h +++ b/atom/browser/common_web_contents_delegate.h @@ -34,6 +34,8 @@ class CommonWebContentsDelegate // Set the window as owner window. void SetOwnerWindow(NativeWindow* owner_window); + void SetOwnerWindow(content::WebContents* web_contents, + NativeWindow* owner_window); // Destroy the managed InspectableWebContents object. void DestroyWebContents(); From ef4014e14b9344204eb0f9636cbcf0af0c284cc2 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 1 Oct 2015 14:46:33 +0800 Subject: [PATCH 28/65] Don't show open dialog as sheet in devtools --- atom/renderer/lib/inspector.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom/renderer/lib/inspector.coffee b/atom/renderer/lib/inspector.coffee index 126f68f960..5f08a2acf8 100644 --- a/atom/renderer/lib/inspector.coffee +++ b/atom/renderer/lib/inspector.coffee @@ -44,7 +44,7 @@ createMenu = (x, y, items, document) -> showFileChooserDialog = (callback) -> remote = require 'remote' dialog = remote.require 'dialog' - files = dialog.showOpenDialog remote.getCurrentWindow(), null + files = dialog.showOpenDialog {} callback pathToHtml5FileObject files[0] if files? pathToHtml5FileObject = (path) -> From af971a46bd125ac778faa27e2a6a6eb52d1f77a1 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 1 Oct 2015 16:30:31 +0800 Subject: [PATCH 29/65] docs: Move devtools methods to WebContents --- docs/api/browser-window.md | 57 -------------------------------------- docs/api/web-contents.md | 57 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/docs/api/browser-window.md b/docs/api/browser-window.md index c71cb610fc..1a2870f205 100644 --- a/docs/api/browser-window.md +++ b/docs/api/browser-window.md @@ -231,18 +231,6 @@ Emitted when the window enters full screen state triggered by html api. Emitted when the window leaves full screen state triggered by html api. -### Event: 'devtools-opened' - -Emitted when DevTools is opened. - -### Event: 'devtools-closed' - -Emitted when DevTools is closed. - -### Event: 'devtools-focused' - -Emitted when DevTools is focused / opened. - ### Event: 'app-command': Emitted when an [App Command](https://msdn.microsoft.com/en-us/library/windows/desktop/ms646275(v=vs.85).aspx) @@ -317,16 +305,6 @@ operations will be done via it. See the [`webContents` documentation](web-contents.md) for its methods and events. -**Note:** Users should never store this object because it may become `null` -when the renderer process (web page) has crashed. - -### `win.devToolsWebContents` - -Get the `WebContents` of DevTools for this window. - -**Note:** Users should never store this object because it may become `null` -when the DevTools has been closed. - ### `win.id` The unique ID of this window. @@ -595,41 +573,6 @@ bar will become grey when set to `true`. Whether the window's document has been edited. -### `win.openDevTools([options])` - -* `options` Object (optional). Properties: - * `detach` Boolean - opens DevTools in a new window - -Opens the developer tools. - -### `win.closeDevTools()` - -Closes the developer tools. - -### `win.isDevToolsOpened()` - -Returns whether the developer tools are opened. - -### `win.toggleDevTools()` - -Toggles the developer tools. - -### `win.isDevToolsFocused()` - -Returns whether the developer tools is focused. - -### `win.inspectElement(x, y)` - -* `x` Integer -* `y` Integer - -Starts inspecting element at position (`x`, `y`). - -### `win.inspectServiceWorker()` - -Opens the developer tools for the service worker context present in the web -contents. - ### `win.focusOnWebView()` ### `win.blurWebView()` diff --git a/docs/api/web-contents.md b/docs/api/web-contents.md index 7cbf8d93ba..08670bad9d 100644 --- a/docs/api/web-contents.md +++ b/docs/api/web-contents.md @@ -154,6 +154,18 @@ Emitted when a plugin process has crashed. Emitted when `webContents` is destroyed. +### Event: 'devtools-opened' + +Emitted when DevTools is opened. + +### Event: 'devtools-closed' + +Emitted when DevTools is closed. + +### Event: 'devtools-focused' + +Emitted when DevTools is focused / opened. + ## Instance Methods The `webContents` object has the following instance methods: @@ -441,6 +453,40 @@ Adds the specified path to DevTools workspace. Removes the specified path from DevTools workspace. +### `webContents.openDevTools([options])` + +* `options` Object (optional). Properties: + * `detach` Boolean - opens DevTools in a new window + +Opens the developer tools. + +### `webContents.closeDevTools()` + +Closes the developer tools. + +### `webContents.isDevToolsOpened()` + +Returns whether the developer tools are opened. + +### `webContents.toggleDevTools()` + +Toggles the developer tools. + +### `webContents.isDevToolsFocused()` + +Returns whether the developer tools is focused. + +### `webContents.inspectElement(x, y)` + +* `x` Integer +* `y` Integer + +Starts inspecting element at position (`x`, `y`). + +### `webContents.inspectServiceWorker()` + +Opens the developer tools for the service worker context. + ### `webContents.send(channel[, args...])` * `channel` String @@ -574,3 +620,14 @@ is in 32bit ARGB format). ### `webContents.endFrameSubscription()` End subscribing for frame presentation events. + +## Instance Properties + +`WebContents` objects also have the following properties: + +### `webContents.devToolsWebContents` + +Get the `WebContents` of DevTools for this `WebContents`. + +**Note:** Users should never store this object because it may become `null` +when the DevTools has been closed. From 6082b83a6522cd68ca5934f4bd50e69461cd1838 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 1 Oct 2015 17:03:45 +0800 Subject: [PATCH 30/65] Update brightray for #2851 --- vendor/brightray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/brightray b/vendor/brightray index 75f7d3fd88..6cbb4ad4d1 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 75f7d3fd88ae60026a0717b93e3bf7182f827dc3 +Subproject commit 6cbb4ad4d173d25b66eecf675c2b25ee64196429 From 63c065299a61a4133f801d08dfd2c0f3381d92c4 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 1 Oct 2015 17:31:44 +0800 Subject: [PATCH 31/65] Update brightray for atom/brightray#147 --- vendor/brightray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/brightray b/vendor/brightray index 6cbb4ad4d1..a4b793cf32 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 6cbb4ad4d173d25b66eecf675c2b25ee64196429 +Subproject commit a4b793cf32ff550f7fff87148464d4d02afa880b From 8d61531f4e344a9244305e5d0832d8cf536bbfb2 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 1 Oct 2015 17:46:11 +0800 Subject: [PATCH 32/65] Revert #2879 --- atom/browser/native_window.cc | 7 +------ atom/browser/native_window_mac.mm | 4 ---- atom/browser/native_window_views.cc | 3 --- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index b3ac71d210..80a7d1347f 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -158,13 +158,8 @@ void NativeWindow::InitFromOptions(const mate::Dictionary& options) { // Then show it. bool show = true; options.Get(switches::kShow, &show); - if (show) { + if (show) Show(); - } else { - // When RenderView is created it sets to visible, this is to prevent - // breaking the visibility API. - web_contents()->WasHidden(); - } } void NativeWindow::SetSize(const gfx::Size& size) { diff --git a/atom/browser/native_window_mac.mm b/atom/browser/native_window_mac.mm index f0a685e4d9..3e8dab2133 100644 --- a/atom/browser/native_window_mac.mm +++ b/atom/browser/native_window_mac.mm @@ -470,8 +470,6 @@ bool NativeWindowMac::IsFocused() { } void NativeWindowMac::Show() { - web_contents()->WasShown(); - // This method is supposed to put focus on window, however if the app does not // have focus then "makeKeyAndOrderFront" will only show the window. [NSApp activateIgnoringOtherApps:YES]; @@ -480,13 +478,11 @@ void NativeWindowMac::Show() { } void NativeWindowMac::ShowInactive() { - web_contents()->WasShown(); [window_ orderFrontRegardless]; } void NativeWindowMac::Hide() { [window_ orderOut:nil]; - web_contents()->WasHidden(); } bool NativeWindowMac::IsVisible() { diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 0fa2a99c27..e9db97e195 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -343,17 +343,14 @@ bool NativeWindowViews::IsFocused() { } void NativeWindowViews::Show() { - web_contents()->WasShown(); window_->native_widget_private()->ShowWithWindowState(GetRestoredState()); } void NativeWindowViews::ShowInactive() { - web_contents()->WasShown(); window_->ShowInactive(); } void NativeWindowViews::Hide() { - window_->Hide(); web_contents()->WasHidden(); } From 5d9e4fc8fd98360e22ce4725174c07592e5e3ad0 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 1 Oct 2015 18:39:35 +0800 Subject: [PATCH 33/65] Override document.hidden --- atom/renderer/lib/override.coffee | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/atom/renderer/lib/override.coffee b/atom/renderer/lib/override.coffee index 5cffdd486d..93cf8b8357 100644 --- a/atom/renderer/lib/override.coffee +++ b/atom/renderer/lib/override.coffee @@ -122,3 +122,7 @@ window.history.go = (offset) -> sendHistoryOperation 'goToOffset', offset Object.defineProperty window.history, 'length', get: -> getHistoryOperation 'length' + +# Make document.hidden return the correct value. +Object.defineProperty document, 'hidden', + get: -> !remote.getCurrentWindow().isVisible() From c1fba9b4a5c90a7afe001a02629be703c4d6a1c1 Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Fri, 2 Oct 2015 12:46:42 +0900 Subject: [PATCH 34/65] Update as upstream --- docs-translations/ko-KR/api/menu.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs-translations/ko-KR/api/menu.md b/docs-translations/ko-KR/api/menu.md index a8ac499f57..56b7f4a198 100644 --- a/docs-translations/ko-KR/api/menu.md +++ b/docs-translations/ko-KR/api/menu.md @@ -229,11 +229,11 @@ Menu.setApplicationMenu(menu); 또한 `template`에는 다른 속성도 추가할 수 있으며 메뉴가 만들어질 때 해당 메뉴 아이템의 프로퍼티로 변환됩니다. -### `Menu.popup(browserWindow[, x, y])` +### `Menu.popup([browserWindow, x, y])` -* `browserWindow` BrowserWindow +* `browserWindow` BrowserWindow (optional) * `x` Number (optional) -* `y` Number (만약 `x`를 지정했을 경우 `y`도 필수로 지정해야 합니다) +* `y` Number (만약 `x`를 지정했을 경우 반드시 `y`도 지정해야 합니다) 메뉴를 `browserWindow` 내부 팝업으로 표시합니다. 옵션으로 메뉴를 표시할 `(x,y)` 좌표를 지정할 수 있습니다. From 9eb7c3ac2d6653834803f91ad3f643f30df9eab5 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 2 Oct 2015 13:41:50 +0800 Subject: [PATCH 35/65] Bump v0.33.4 --- atom.gyp | 2 +- atom/browser/resources/mac/Info.plist | 2 +- atom/browser/resources/win/atom.rc | 8 ++++---- atom/common/atom_version.h | 2 +- vendor/brightray | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/atom.gyp b/atom.gyp index 42069ea846..b3c9e117a5 100644 --- a/atom.gyp +++ b/atom.gyp @@ -4,7 +4,7 @@ 'product_name%': 'Electron', 'company_name%': 'GitHub, Inc', 'company_abbr%': 'github', - 'version%': '0.33.3', + 'version%': '0.33.4', }, 'includes': [ 'filenames.gypi', diff --git a/atom/browser/resources/mac/Info.plist b/atom/browser/resources/mac/Info.plist index eb39cb35f9..b1b905a433 100644 --- a/atom/browser/resources/mac/Info.plist +++ b/atom/browser/resources/mac/Info.plist @@ -17,7 +17,7 @@ CFBundleIconFile atom.icns CFBundleVersion - 0.33.3 + 0.33.4 LSMinimumSystemVersion 10.8.0 NSMainNibFile diff --git a/atom/browser/resources/win/atom.rc b/atom/browser/resources/win/atom.rc index 6fba6cf806..6d900b0ea0 100644 --- a/atom/browser/resources/win/atom.rc +++ b/atom/browser/resources/win/atom.rc @@ -56,8 +56,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,33,3,0 - PRODUCTVERSION 0,33,3,0 + FILEVERSION 0,33,4,0 + PRODUCTVERSION 0,33,4,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -74,12 +74,12 @@ BEGIN BEGIN VALUE "CompanyName", "GitHub, Inc." VALUE "FileDescription", "Electron" - VALUE "FileVersion", "0.33.3" + VALUE "FileVersion", "0.33.4" VALUE "InternalName", "electron.exe" VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved." VALUE "OriginalFilename", "electron.exe" VALUE "ProductName", "Electron" - VALUE "ProductVersion", "0.33.3" + VALUE "ProductVersion", "0.33.4" VALUE "SquirrelAwareVersion", "1" END END diff --git a/atom/common/atom_version.h b/atom/common/atom_version.h index 4f24034754..998e430881 100644 --- a/atom/common/atom_version.h +++ b/atom/common/atom_version.h @@ -7,7 +7,7 @@ #define ATOM_MAJOR_VERSION 0 #define ATOM_MINOR_VERSION 33 -#define ATOM_PATCH_VERSION 3 +#define ATOM_PATCH_VERSION 4 #define ATOM_VERSION_IS_RELEASE 1 diff --git a/vendor/brightray b/vendor/brightray index a4b793cf32..6cbb4ad4d1 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit a4b793cf32ff550f7fff87148464d4d02afa880b +Subproject commit 6cbb4ad4d173d25b66eecf675c2b25ee64196429 From 0ecf077590ef64e88a31fff81fe50590a8c42c82 Mon Sep 17 00:00:00 2001 From: Jhen Date: Fri, 2 Oct 2015 21:53:55 +0800 Subject: [PATCH 36/65] Fix typo for docs/api/menu-item.md --- docs/api/menu-item.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/menu-item.md b/docs/api/menu-item.md index 89524d9f23..37079233fc 100644 --- a/docs/api/menu-item.md +++ b/docs/api/menu-item.md @@ -1,6 +1,6 @@ # MenuItem -The `menu-item` module allows you to add items to an application or content +The `menu-item` module allows you to add items to an application or context [`menu`](menu.md). See [`menu`](menu.md) for examples. From 64640afc20bba0e6474a3bb2b61c0d72a379185c Mon Sep 17 00:00:00 2001 From: Raphael Date: Fri, 2 Oct 2015 17:41:57 -0700 Subject: [PATCH 37/65] supported operating system list Proposed fix for issue #2964 --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 0bf29fbc3e..ccfc9cf200 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,12 @@ npm install electron-prebuilt --save-dev - [China](https://npm.taobao.org/mirrors/electron) +## Supported Operating Systems + +- Ubuntu: 14.04 and higher +- Mac: OS X 10.8.0 and higher +- Windows: Win7 or higher + ## Documentation Guides and the API reference are located in the @@ -53,6 +59,7 @@ contains documents describing how to build and contribute to Electron. - [Simplified Chinese](https://github.com/atom/electron/tree/master/docs-translations/zh-CN) - [Traditional Chinese](https://github.com/atom/electron/tree/master/docs-translations/zh-TW) + ## Community You can ask questions and interact with the community in the following From 651009a1dc4cfe901a24ca829413719e906fb00e Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 3 Oct 2015 13:42:34 +0800 Subject: [PATCH 38/65] docs: Add "Supported Platforms" --- README.md | 15 ++++----------- docs/README.md | 1 + docs/tutorial/supported-platforms.md | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 docs/tutorial/supported-platforms.md diff --git a/README.md b/README.md index ccfc9cf200..fa122c9b6c 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Follow [@ElectronJS](https://twitter.com/electronjs) on Twitter for important announcements. This project adheres to the [Contributor Covenant 1.2](http://contributor-covenant.org/version/1/2/0). -By participating, you are expected to uphold this code. Please report +By participating, you are expected to uphold this code. Please report unacceptable behavior to atom@github.com. ## Downloads @@ -38,12 +38,6 @@ npm install electron-prebuilt --save-dev - [China](https://npm.taobao.org/mirrors/electron) -## Supported Operating Systems - -- Ubuntu: 14.04 and higher -- Mac: OS X 10.8.0 and higher -- Windows: Win7 or higher - ## Documentation Guides and the API reference are located in the @@ -59,15 +53,14 @@ contains documents describing how to build and contribute to Electron. - [Simplified Chinese](https://github.com/atom/electron/tree/master/docs-translations/zh-CN) - [Traditional Chinese](https://github.com/atom/electron/tree/master/docs-translations/zh-TW) - ## Community -You can ask questions and interact with the community in the following +You can ask questions and interact with the community in the following locations: -- [`electron`](http://discuss.atom.io/category/electron) category on the Atom +- [`electron`](http://discuss.atom.io/category/electron) category on the Atom forums - `#atom-shell` channel on Freenode - [`Atom`](http://atom-slack.herokuapp.com/) channel on Slack -Check out [awesome-electron](https://github.com/sindresorhus/awesome-electron) +Check out [awesome-electron](https://github.com/sindresorhus/awesome-electron) for a community maintained list of useful example apps, tools and resources. diff --git a/docs/README.md b/docs/README.md index b2f95fe4b5..eb6e9d6e36 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,6 @@ ## Guides +* [Supported Platforms](tutorial/supported-platforms.md) * [Application Distribution](tutorial/application-distribution.md) * [Application Packaging](tutorial/application-packaging.md) * [Using Native Node Modules](tutorial/using-native-node-modules.md) diff --git a/docs/tutorial/supported-platforms.md b/docs/tutorial/supported-platforms.md new file mode 100644 index 0000000000..8b795769a8 --- /dev/null +++ b/docs/tutorial/supported-platforms.md @@ -0,0 +1,23 @@ +# Supported Platforms + +Following platforms are supported by Electron: + +### OS X + +Only 64bit binaries are provided for OS X, and the minimum OS X version supported is OS X 10.8. + +### Windows + +Windows 7 and later are supported, Electron should be able to run on Windows Vista, but there is no testing done on it. + +Both `x86` and `x64` binaries are provided for Windows, and `ARM` version of Windows is not supported for now. + +### Linux + +The prebuilt `ia32`(`i686`) and `x64`(`amd64`) binaries of Electron are built on Ubuntu 12.04, the `arm` binary is built against ARM v7 with hard-float ABI and NEON for Debian Wheezy. + +Whether the prebuilt binary can run on a distribution depends on whether the distribution includes the libraries that Electron is linked to on the building platform, so only Ubuntu 12.04 is guaranteed to work, but following platforms are also verified to be able to run the prebuilt binaries of Electron: + +* Ubuntu 12.04 and later +* Fedora 21 +* Debian 8 From 0f9f8e62fc801b724278b45a61a5c7f6828ca204 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 3 Oct 2015 13:53:52 +0800 Subject: [PATCH 39/65] docs: No leading slash in --url-base Fixes #2968. --- docs/tutorial/using-selenium-and-webdriver.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/using-selenium-and-webdriver.md b/docs/tutorial/using-selenium-and-webdriver.md index ebc6d2fa78..b87f8f11da 100644 --- a/docs/tutorial/using-selenium-and-webdriver.md +++ b/docs/tutorial/using-selenium-and-webdriver.md @@ -74,7 +74,7 @@ driver. First you need to download the `chromedriver` binary, and run it: ```bash -$ chromedriver --url-base=/wd/hub --port=9515 +$ chromedriver --url-base=wd/hub --port=9515 Starting ChromeDriver (v2.10.291558) on port 9515 Only local connections are allowed. ``` From 3503b62ff290f7897ca1f0cf304dbc6b630152c0 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 3 Oct 2015 15:33:55 +0800 Subject: [PATCH 40/65] Disable logging unless --enable-logging is specified --- atom/app/atom_main_delegate.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/atom/app/atom_main_delegate.cc b/atom/app/atom_main_delegate.cc index 3c7d6b2e70..fe3c0e09ae 100644 --- a/atom/app/atom_main_delegate.cc +++ b/atom/app/atom_main_delegate.cc @@ -27,10 +27,10 @@ AtomMainDelegate::~AtomMainDelegate() { } bool AtomMainDelegate::BasicStartupComplete(int* exit_code) { - // Disable logging out to debug.log on Windows logging::LoggingSettings settings; #if defined(OS_WIN) #if defined(DEBUG) + // Print logging to debug.log on Windows settings.logging_dest = logging::LOG_TO_ALL; settings.log_file = L"debug.log"; settings.lock_log = logging::LOCK_LOG_FILE; @@ -41,6 +41,12 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) { #else // defined(OS_WIN) settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; #endif // !defined(OS_WIN) + + // Only enable logging when --enable-logging is specified. + auto command_line = base::CommandLine::ForCurrentProcess(); + if (!command_line->HasSwitch(switches::kEnableLogging)) + settings.logging_dest = logging::LOG_NONE; + logging::InitLogging(settings); // Logging with pid and timestamp. From 55acdcb1ad3e999f9f0ac5cd115203216ed25989 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 3 Oct 2015 15:43:26 +0800 Subject: [PATCH 41/65] docs: --enable-logging --- docs/api/chrome-command-line-switches.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/api/chrome-command-line-switches.md b/docs/api/chrome-command-line-switches.md index cd633fc046..c2a39126f6 100644 --- a/docs/api/chrome-command-line-switches.md +++ b/docs/api/chrome-command-line-switches.md @@ -89,15 +89,21 @@ Enables net log events to be saved and writes them to `path`. ## --ssl-version-fallback-min=`version` -Set the minimum SSL/TLS version ("tls1", "tls1.1" or "tls1.2") that TLS +Sets the minimum SSL/TLS version ("tls1", "tls1.1" or "tls1.2") that TLS fallback will accept. +## --enable-logging + +Prints Chromium's logging into console. + +This switch can not be used in `app.commandLine.appendSwitch` since it is parsed earlier than user's app is loaded. + ## --v=`log_level` Gives the default maximal active V-logging level; 0 is the default. Normally positive values are used for V-logging levels. -Passing `--v=-1` will disable logging. +This switch only works when `--enable-logging` is also passed. ## --vmodule=`pattern` @@ -109,10 +115,4 @@ Any pattern containing a forward or backward slash will be tested against the 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. -To disable all chromium related logs and only enable your application logs you -can do: - -```javascript -app.commandLine.appendSwitch('v', -1); -app.commandLine.appendSwitch('vmodule', 'console=0'); -``` +This switch only works when `--enable-logging` is also passed. From b78bb8442406cd6df63966b851ab59928dd92b3a Mon Sep 17 00:00:00 2001 From: Plusb Preco Date: Sat, 3 Oct 2015 17:54:05 +0900 Subject: [PATCH 42/65] Update as upstream --- docs-translations/ko-KR/README.md | 1 + .../ko-KR/api/chrome-command-line-switches.md | 18 ++++++------- docs-translations/ko-KR/api/menu-item.md | 2 +- .../ko-KR/tutorial/supported-platforms.md | 26 +++++++++++++++++++ .../tutorial/using-selenium-and-webdriver.md | 2 +- 5 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 docs-translations/ko-KR/tutorial/supported-platforms.md diff --git a/docs-translations/ko-KR/README.md b/docs-translations/ko-KR/README.md index 1e0ba63e7b..9b88aa6e17 100644 --- a/docs-translations/ko-KR/README.md +++ b/docs-translations/ko-KR/README.md @@ -1,5 +1,6 @@ ## 개발 가이드 +* [지원하는 플랫폼](tutorial/supported-platforms.md) * [어플리케이션 배포](tutorial/application-distribution.md) * [어플리케이션 패키징](tutorial/application-packaging.md) * [네이티브 Node 모듈 사용하기](tutorial/using-native-node-modules.md) diff --git a/docs-translations/ko-KR/api/chrome-command-line-switches.md b/docs-translations/ko-KR/api/chrome-command-line-switches.md index 2d9158fcc2..777ce4612d 100644 --- a/docs-translations/ko-KR/api/chrome-command-line-switches.md +++ b/docs-translations/ko-KR/api/chrome-command-line-switches.md @@ -84,13 +84,19 @@ Net log 이벤트를 활성화하고 `path`에 로그를 기록합니다. ## --ssl-version-fallback-min=`version` -Fallback SSL/TLS 최소 버전을 지정합니다. ("tls1", "tls1.1", "tls1.2") +TLS fallback에서 사용할 SSL/TLS 최소 버전을 지정합니다. ("tls1", "tls1.1", "tls1.2") + +## --enable-logging + +Chromium의 로그를 콘솔에 출력합니다. + +이 스위치는 어플리케이션이 로드되기 전에 파싱 되므로 `app.commandLine.appendSwitch`에서 사용할 수 없습니다. ## --v=`log_level` 기본 V-logging 최대 활성화 레벨을 지정합니다. 기본값은 0입니다. 기본적으로 양수를 레벨로 사용합니다. -`--v=-1`를 사용하면 로깅이 비활성화 됩니다. +이 스위치는 `--enable-logging` 스위치를 같이 지정해야 작동합니다. ## --vmodule=`pattern` @@ -100,10 +106,4 @@ Fallback SSL/TLS 최소 버전을 지정합니다. ("tls1", "tls1.1", "tls1.2") 또한 슬래시(`/`) 또는 백슬래시(`\`)를 포함하는 패턴은 지정한 경로에 대해 패턴을 테스트 합니다. 예를 들어 `*/foo/bar/*=2` 표현식은 `foo/bar` 디렉터리 안의 모든 소스 코드의 로깅 레벨을 2로 지정합니다. -모든 크로미움과 관련된 로그를 비활성화하고 어플리케이션의 로그만 활성화 하려면 다음과 같이 코드를 작성하면 됩니다: - - -```javascript -app.commandLine.appendSwitch('v', -1); -app.commandLine.appendSwitch('vmodule', 'console=0'); -``` +이 스위치는 `--enable-logging` 스위치를 같이 지정해야 작동합니다. diff --git a/docs-translations/ko-KR/api/menu-item.md b/docs-translations/ko-KR/api/menu-item.md index 8f10210099..e4c5c67767 100644 --- a/docs-translations/ko-KR/api/menu-item.md +++ b/docs-translations/ko-KR/api/menu-item.md @@ -1,6 +1,6 @@ # MenuItem -`menu-item` 모듈은 어플리케이션 또는 컨텐츠 [`menu`](menu.md)에 아이템을 추가할 수 있도록 관련 클래스를 제공합니다. +`menu-item` 모듈은 어플리케이션 또는 컨텍스트 [`menu`](menu.md)에 아이템을 추가할 수 있도록 관련 클래스를 제공합니다. [`menu`](menu.md)에서 예제를 확인할 수 있습니다. diff --git a/docs-translations/ko-KR/tutorial/supported-platforms.md b/docs-translations/ko-KR/tutorial/supported-platforms.md new file mode 100644 index 0000000000..7a35da0c12 --- /dev/null +++ b/docs-translations/ko-KR/tutorial/supported-platforms.md @@ -0,0 +1,26 @@ +# 지원하는 플랫폼 + +Electron에선 다음과 같은 플랫폼을 지원합니다: + +### OS X + +OS X는 64비트 바이너리만 제공됩니다. 그리고 최소 OS X 지원 버전은 10.8입니다. + +### Windows + +Windows 7 이후 버전만 지원됩니다. Windows Vista에서도 작동할 수 있지만 아직 모든 작동 테스트가 완료되지 않았습니다. + +윈도우용 바이너리는 `x86`과 `x64` 모두 제공됩니다. 그리고 `ARM` 버전 윈도우는 아직 지원하지 않습니다. (역주: 추후 지원할 가능성이 있습니다) + +### Linux + +Ubuntu 12.04 버전에서 빌드된 `ia32`(`i686`), `x64`(`amd64`) 바이너리가 제공됩니다. +그리고 `arm` 버전 바이너리는 ARM v7 hard-float ABI와 Debian Wheezy용 NEON에 맞춰 제공됩니다. + +미리 빌드된 바이너리가 배포판에서 작동할 수 있는지 여부는 Electron이 빌드된 플랫폼에서 링크된 라이브러리에 따라 달라집니다. +그래서 현재 Linux 바이너리는 Ubuntu 12.04 버전만 정상적인 작동이 보장됩니다. +하지만 다음 플랫폼들은 미리 빌드된 Electron 바이너리가 정상적으로 작동하는 것을 확인했습니다: + +* Ubuntu 12.04 이후 버전 +* Fedora 21 +* Debian 8 diff --git a/docs-translations/ko-KR/tutorial/using-selenium-and-webdriver.md b/docs-translations/ko-KR/tutorial/using-selenium-and-webdriver.md index 33dc6311ce..a9fd84a68b 100644 --- a/docs-translations/ko-KR/tutorial/using-selenium-and-webdriver.md +++ b/docs-translations/ko-KR/tutorial/using-selenium-and-webdriver.md @@ -71,7 +71,7 @@ driver.quit(); 먼저, `chromedriver` 바이너리를 다운로드 받고 실행합니다: ```bash -$ chromedriver --url-base=/wd/hub --port=9515 +$ chromedriver --url-base=wd/hub --port=9515 Starting ChromeDriver (v2.10.291558) on port 9515 Only local connections are allowed. ``` From 021ee20400ea4636090fb41213f3dcfd1770edf6 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 3 Oct 2015 17:52:46 +0800 Subject: [PATCH 43/65] No need to add "app" to search paths --- atom/renderer/lib/init.coffee | 3 --- 1 file changed, 3 deletions(-) diff --git a/atom/renderer/lib/init.coffee b/atom/renderer/lib/init.coffee index 274c50ec5f..ff9b12ecbf 100644 --- a/atom/renderer/lib/init.coffee +++ b/atom/renderer/lib/init.coffee @@ -11,9 +11,6 @@ process.argv.splice 1, 1 # of Atom's built-in libraries. globalPaths = Module.globalPaths globalPaths.push path.resolve(__dirname, '..', 'api', 'lib') -# And also app. -globalPaths.push path.join(process.resourcesPath, 'app') -globalPaths.push path.join(process.resourcesPath, 'app.asar') # Import common settings. require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init') From 9fe326ebeb43ffb2c955945ca8b4a2135efb08c2 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 3 Oct 2015 19:55:59 +0800 Subject: [PATCH 44/65] Clear node's global search paths --- atom/browser/lib/init.coffee | 6 +++--- atom/common/lib/init.coffee | 13 ++----------- atom/renderer/lib/init.coffee | 6 +++--- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/atom/browser/lib/init.coffee b/atom/browser/lib/init.coffee index 454baf0b8a..44ae29522e 100644 --- a/atom/browser/lib/init.coffee +++ b/atom/browser/lib/init.coffee @@ -7,14 +7,14 @@ Module = require 'module' # we need to restore it here. process.argv.splice 1, 1 +# Import common settings. +require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init') + # Add browser/api/lib to module search paths, which contains javascript part of # Electron's built-in libraries. globalPaths = Module.globalPaths globalPaths.push path.resolve(__dirname, '..', 'api', 'lib') -# Import common settings. -require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init') - if process.platform is 'win32' # Redirect node's console to use our own implementations, since node can not # handle console output when running as GUI program. diff --git a/atom/common/lib/init.coffee b/atom/common/lib/init.coffee index acb635edea..2bfea3d72a 100644 --- a/atom/common/lib/init.coffee +++ b/atom/common/lib/init.coffee @@ -9,18 +9,9 @@ process.atomBinding = (name) -> catch e process.binding "atom_common_#{name}" if /No such module/.test e.message -# Global module search paths. +# Clear node's global search paths. globalPaths = Module.globalPaths - -# Don't lookup modules in user-defined search paths, see http://git.io/vf8sF. -homeDir = - if process.platform is 'win32' - process.env.USERPROFILE - else - process.env.HOME -if homeDir # Node only add user-defined search paths when $HOME is defined. - userModulePath = path.resolve homeDir, '.node_modules' - globalPaths.splice globalPaths.indexOf(userModulePath), 2 +globalPaths.length = 0 # Add common/api/lib to module search paths. globalPaths.push path.resolve(__dirname, '..', 'api', 'lib') diff --git a/atom/renderer/lib/init.coffee b/atom/renderer/lib/init.coffee index ff9b12ecbf..e5173fcd1e 100644 --- a/atom/renderer/lib/init.coffee +++ b/atom/renderer/lib/init.coffee @@ -7,14 +7,14 @@ Module = require 'module' # atom-renderer.js, we need to restore it here. process.argv.splice 1, 1 +# Import common settings. +require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init') + # Add renderer/api/lib to require's search paths, which contains javascript part # of Atom's built-in libraries. globalPaths = Module.globalPaths globalPaths.push path.resolve(__dirname, '..', 'api', 'lib') -# Import common settings. -require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init') - # The global variable will be used by ipc for event dispatching v8Util = process.atomBinding 'v8_util' v8Util.setHiddenValue global, 'ipc', new events.EventEmitter From 01d2765e4b566df853cd583006ebc7993d48cd38 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 3 Oct 2015 20:38:39 +0800 Subject: [PATCH 45/65] Prevent Node from adding paths outside this app to search paths --- atom/browser/lib/init.coffee | 3 +++ atom/common/lib/init.coffee | 6 +---- atom/common/lib/reset-search-paths.coffee | 29 +++++++++++++++++++++++ atom/renderer/lib/init.coffee | 3 +++ filenames.gypi | 1 + 5 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 atom/common/lib/reset-search-paths.coffee diff --git a/atom/browser/lib/init.coffee b/atom/browser/lib/init.coffee index 44ae29522e..b394c0fecc 100644 --- a/atom/browser/lib/init.coffee +++ b/atom/browser/lib/init.coffee @@ -7,6 +7,9 @@ Module = require 'module' # we need to restore it here. process.argv.splice 1, 1 +# Clear search paths. +require path.resolve(__dirname, '..', '..', 'common', 'lib', 'reset-search-paths') + # Import common settings. require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init') diff --git a/atom/common/lib/init.coffee b/atom/common/lib/init.coffee index 2bfea3d72a..1c80e6171a 100644 --- a/atom/common/lib/init.coffee +++ b/atom/common/lib/init.coffee @@ -9,12 +9,8 @@ process.atomBinding = (name) -> catch e process.binding "atom_common_#{name}" if /No such module/.test e.message -# Clear node's global search paths. -globalPaths = Module.globalPaths -globalPaths.length = 0 - # Add common/api/lib to module search paths. -globalPaths.push path.resolve(__dirname, '..', 'api', 'lib') +Module.globalPaths.push path.resolve(__dirname, '..', 'api', 'lib') # setImmediate and process.nextTick makes use of uv_check and uv_prepare to # run the callbacks, however since we only run uv loop on requests, the diff --git a/atom/common/lib/reset-search-paths.coffee b/atom/common/lib/reset-search-paths.coffee new file mode 100644 index 0000000000..7061103306 --- /dev/null +++ b/atom/common/lib/reset-search-paths.coffee @@ -0,0 +1,29 @@ +path = require 'path' +Module = require 'module' + +# Clear Node's global search paths. +Module.globalPaths.length = 0 + +# Clear current and parent(init.coffee)'s search paths. +module.paths = [] +module.parent.paths = [] + +# Prevent Node from adding paths outside this app to search paths. +Module._nodeModulePaths = (from) -> + from = path.resolve from + + # If "from" is outside the app then we do nothing. + skipOutsidePaths = from.startsWith process.resourcesPath + + # Following logoic is copied from module.js. + splitRe = if process.platform is 'win32' then /[\/\\]/ else /\// + paths = [] + + parts = from.split splitRe + for part, tip in parts by -1 + continue if part is 'node_modules' + dir = parts.slice(0, tip + 1).join path.sep + break if skipOutsidePaths and not dir.startsWith process.resourcesPath + paths.push path.join(dir, 'node_modules') + + paths diff --git a/atom/renderer/lib/init.coffee b/atom/renderer/lib/init.coffee index e5173fcd1e..b7224b39ae 100644 --- a/atom/renderer/lib/init.coffee +++ b/atom/renderer/lib/init.coffee @@ -7,6 +7,9 @@ Module = require 'module' # atom-renderer.js, we need to restore it here. process.argv.splice 1, 1 +# Clear search paths. +require path.resolve(__dirname, '..', '..', 'common', 'lib', 'reset-search-paths') + # Import common settings. require path.resolve(__dirname, '..', '..', 'common', 'lib', 'init') diff --git a/filenames.gypi b/filenames.gypi index 0e7010d7a4..000633fb96 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -37,6 +37,7 @@ 'atom/common/api/lib/native-image.coffee', 'atom/common/api/lib/shell.coffee', 'atom/common/lib/init.coffee', + 'atom/common/lib/reset-search-paths.coffee', 'atom/renderer/lib/chrome-api.coffee', 'atom/renderer/lib/init.coffee', 'atom/renderer/lib/inspector.coffee', From b4ec7c5aaf09d7125124658f269954cacc1765c0 Mon Sep 17 00:00:00 2001 From: chriswmercer Date: Sat, 3 Oct 2015 18:03:49 +0100 Subject: [PATCH 46/65] Minor grammar correction --- docs/tutorial/supported-platforms.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/supported-platforms.md b/docs/tutorial/supported-platforms.md index 8b795769a8..ec0f3ef6a1 100644 --- a/docs/tutorial/supported-platforms.md +++ b/docs/tutorial/supported-platforms.md @@ -10,7 +10,7 @@ Only 64bit binaries are provided for OS X, and the minimum OS X version supporte Windows 7 and later are supported, Electron should be able to run on Windows Vista, but there is no testing done on it. -Both `x86` and `x64` binaries are provided for Windows, and `ARM` version of Windows is not supported for now. +Both `x86` and `x64` binaries are provided for Windows. Please note, the `ARM` version of Windows is not supported for now. ### Linux From aea1f8aebb8faf71c2c54c815b72ad9a8c21a88e Mon Sep 17 00:00:00 2001 From: Eran Tiktin Date: Sat, 3 Oct 2015 22:09:57 +0300 Subject: [PATCH 47/65] Fix calculating min/max size in frameless views The minimum and maximum size that frameless windows had used, was incorrect. It included the border, so when it was called it actually added that to the size, so window increased in size. The fix makes sure that the view will use the frameless size. This fixes #2945 and partially fixes #1806 (it also refers to some other issues with hidpi which might still exist). --- atom/browser/native_window_views.cc | 29 +++++++++++++++++++++++-- atom/browser/native_window_views.h | 2 ++ atom/browser/ui/views/frameless_view.cc | 8 +++++-- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index e9db97e195..40d702e35a 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -818,9 +818,7 @@ bool NativeWindowViews::ExecuteWindowsCommand(int command_id) { NotifyWindowExecuteWindowsCommand(command); return false; } -#endif -#if defined(OS_WIN) bool NativeWindowViews::PreHandleMSG( UINT message, WPARAM w_param, LPARAM l_param, LRESULT* result) { switch (message) { @@ -874,6 +872,33 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) { } #endif +gfx::Size NativeWindowViews::WindowSizeToFramelessSize( + const gfx::Size& size) { + if (size.width() == 0 && size.height() == 0) + return size; + + gfx::Rect window_bounds = gfx::Rect(size); + if (use_content_size_) { + if (menu_bar_ && menu_bar_visible_) { + window_bounds.set_height(window_bounds.height() + kMenuBarHeight); + } + } else if (has_frame()) { +#if defined(OS_WIN) + gfx::Size frame_size = gfx::win::ScreenToDIPRect( + window_->non_client_view()->GetWindowBoundsForClientBounds( + gfx::Rect())).size(); +#else + gfx::Size frame_size = + window_->non_client_view()->GetWindowBoundsForClientBounds( + gfx::Rect()).size(); +#endif + window_bounds.set_height(window_bounds.height() - frame_size.height()); + window_bounds.set_width(window_bounds.width() - frame_size.width()); + } + + return window_bounds.size(); +} + void NativeWindowViews::HandleKeyboardEvent( content::WebContents*, const content::NativeWebKeyboardEvent& event) { diff --git a/atom/browser/native_window_views.h b/atom/browser/native_window_views.h index 71e122d381..790e532f84 100644 --- a/atom/browser/native_window_views.h +++ b/atom/browser/native_window_views.h @@ -94,6 +94,8 @@ class NativeWindowViews : public NativeWindow, gfx::AcceleratedWidget GetAcceleratedWidget(); + gfx::Size WindowSizeToFramelessSize(const gfx::Size& size); + views::Widget* widget() const { return window_.get(); } #if defined(OS_WIN) diff --git a/atom/browser/ui/views/frameless_view.cc b/atom/browser/ui/views/frameless_view.cc index 03a31e0828..e8d351ec82 100644 --- a/atom/browser/ui/views/frameless_view.cc +++ b/atom/browser/ui/views/frameless_view.cc @@ -104,11 +104,15 @@ gfx::Size FramelessView::GetPreferredSize() const { } gfx::Size FramelessView::GetMinimumSize() const { - return window_->GetMinimumSize(); + gfx::Size size = window_->WindowSizeToFramelessSize( + window_->GetMinimumSize()); + return size; } gfx::Size FramelessView::GetMaximumSize() const { - return window_->GetMaximumSize(); + gfx::Size size = window_->WindowSizeToFramelessSize( + window_->GetMaximumSize()); + return size; } const char* FramelessView::GetClassName() const { From 5d7cfa1b3ac5b3f578ceca6ceb94dcbddedd4dcf Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 4 Oct 2015 15:53:09 +0800 Subject: [PATCH 48/65] Update brightray for atom/brightray#149 --- vendor/brightray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/brightray b/vendor/brightray index 6cbb4ad4d1..361d99dd05 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 6cbb4ad4d173d25b66eecf675c2b25ee64196429 +Subproject commit 361d99dd05a8368faee20bc39a6ffaedbc67c383 From 791f988aba568921c940713231da1811b6a1cdd3 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 4 Oct 2015 16:32:08 +0800 Subject: [PATCH 49/65] linux: Fix pressing Alt not showing menubar --- atom/browser/native_window_views.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index e9db97e195..4282b0eda9 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -905,9 +905,6 @@ void NativeWindowViews::HandleKeyboardEvent( // When a single Alt is pressed: menu_bar_alt_pressed_ = true; } else if (event.type == blink::WebInputEvent::KeyUp && IsAltKey(event) && -#if defined(USE_X11) - event.modifiers == 0 && -#endif menu_bar_alt_pressed_) { // When a single Alt is released right after a Alt is pressed: menu_bar_alt_pressed_ = false; From add9c380230ae61316156025ef8c9fec85d23f84 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 4 Oct 2015 16:33:03 +0800 Subject: [PATCH 50/65] linux: Enable force showing menubar This is for debugging purpose. --- atom/browser/ui/x/x_window_utils.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/atom/browser/ui/x/x_window_utils.cc b/atom/browser/ui/x/x_window_utils.cc index e57122839c..f5c3f54ec1 100644 --- a/atom/browser/ui/x/x_window_utils.cc +++ b/atom/browser/ui/x/x_window_utils.cc @@ -6,6 +6,7 @@ #include +#include "base/environment.h" #include "base/strings/string_util.h" #include "dbus/bus.h" #include "dbus/object_proxy.h" @@ -50,6 +51,10 @@ void SetWindowType(::Window xwindow, const std::string& type) { } bool ShouldUseGlobalMenuBar() { + scoped_ptr env(base::Environment::Create()); + if (env->HasVar("ELECTRON_FORCE_WINDOW_MENU_BAR")) + return false; + dbus::Bus::Options options; scoped_refptr bus(new dbus::Bus(options)); From 74b76102a84740a618ff3288f27dfad1197d32a2 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 4 Oct 2015 16:53:20 +0800 Subject: [PATCH 51/65] linux: No longer needs to manually read DPI settings It is now done in brightray by reading the value from GTK+. --- atom/browser/atom_browser_main_parts.cc | 4 - atom/browser/atom_browser_main_parts.h | 4 - atom/browser/atom_browser_main_parts_linux.cc | 73 ------------------- filenames.gypi | 1 - vendor/brightray | 2 +- 5 files changed, 1 insertion(+), 83 deletions(-) delete mode 100644 atom/browser/atom_browser_main_parts_linux.cc diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index a1a1192b27..1b46247c49 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -55,10 +55,6 @@ void AtomBrowserMainParts::RegisterDestructionCallback( void AtomBrowserMainParts::PostEarlyInitialization() { brightray::BrowserMainParts::PostEarlyInitialization(); -#if defined(USE_X11) - SetDPIFromGSettings(); -#endif - { // Temporary set the bridge_task_runner_ as current thread's task runner, // so we can fool gin::PerIsolateData to use it as its task runner, instead diff --git a/atom/browser/atom_browser_main_parts.h b/atom/browser/atom_browser_main_parts.h index bcebc86f16..9fefa486a1 100644 --- a/atom/browser/atom_browser_main_parts.h +++ b/atom/browser/atom_browser_main_parts.h @@ -48,10 +48,6 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts { #endif private: -#if defined(USE_X11) - void SetDPIFromGSettings(); -#endif - // A fake BrowserProcess object that used to feed the source code from chrome. scoped_ptr fake_browser_process_; diff --git a/atom/browser/atom_browser_main_parts_linux.cc b/atom/browser/atom_browser_main_parts_linux.cc deleted file mode 100644 index 278e49ac1f..0000000000 --- a/atom/browser/atom_browser_main_parts_linux.cc +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) 2014 GitHub, Inc. -// Use of this source code is governed by the MIT license that can be -// found in the LICENSE file. - -#include "atom/browser/atom_browser_main_parts.h" - -#include - -#include "base/command_line.h" -#include "base/strings/string_number_conversions.h" -#include "ui/gfx/switches.h" - -namespace atom { - -namespace { - -const char* kInterfaceSchema = "org.gnome.desktop.interface"; -const char* kScaleFactor = "scaling-factor"; - -bool SchemaExists(const char* schema_name) { - const gchar* const* schemas = g_settings_list_schemas(); - while (*schemas) { - if (strcmp(schema_name, static_cast(*schemas)) == 0) - return true; - schemas++; - } - return false; -} - -bool KeyExists(GSettings* client, const char* key) { - gchar** keys = g_settings_list_keys(client); - if (!keys) - return false; - - gchar** iter = keys; - while (*iter) { - if (strcmp(*iter, key) == 0) - break; - iter++; - } - - bool exists = *iter != NULL; - g_strfreev(keys); - return exists; -} - -void GetDPIFromGSettings(guint* scale_factor) { - GSettings* client = nullptr; - if (!SchemaExists(kInterfaceSchema) || - !(client = g_settings_new(kInterfaceSchema))) { - VLOG(1) << "Cannot create gsettings client."; - return; - } - - if (KeyExists(client, kScaleFactor)) - *scale_factor = g_settings_get_uint(client, kScaleFactor); - - g_object_unref(client); -} - -} // namespace - -void AtomBrowserMainParts::SetDPIFromGSettings() { - guint scale_factor = 1; - GetDPIFromGSettings(&scale_factor); - if (scale_factor == 0) - scale_factor = 1; - - base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( - switches::kForceDeviceScaleFactor, base::UintToString(scale_factor)); -} - -} // namespace atom diff --git a/filenames.gypi b/filenames.gypi index 000633fb96..eb94973e01 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -124,7 +124,6 @@ 'atom/browser/atom_download_manager_delegate.h', 'atom/browser/atom_browser_main_parts.cc', 'atom/browser/atom_browser_main_parts.h', - 'atom/browser/atom_browser_main_parts_linux.cc', 'atom/browser/atom_browser_main_parts_mac.mm', 'atom/browser/atom_javascript_dialog_manager.cc', 'atom/browser/atom_javascript_dialog_manager.h', diff --git a/vendor/brightray b/vendor/brightray index 361d99dd05..bbb9287337 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 361d99dd05a8368faee20bc39a6ffaedbc67c383 +Subproject commit bbb9287337f8b7958b001be35b993c21cd573109 From bdd2f919137546a560ce808fd386994823628c57 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 4 Oct 2015 19:20:52 +0800 Subject: [PATCH 52/65] Make Browser::Quit more robust --- atom/browser/browser.cc | 15 +++++++++++++-- atom/browser/browser.h | 3 +++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/atom/browser/browser.cc b/atom/browser/browser.cc index 9d2a9fc1ef..d8bb94103c 100644 --- a/atom/browser/browser.cc +++ b/atom/browser/browser.cc @@ -16,7 +16,8 @@ namespace atom { Browser::Browser() : is_quiting_(false), - is_ready_(false) { + is_ready_(false), + is_shutdown_(false) { WindowList::AddObserver(this); } @@ -30,6 +31,9 @@ Browser* Browser::Get() { } void Browser::Quit() { + if (is_quiting_) + return; + is_quiting_ = HandleBeforeQuit(); if (!is_quiting_) return; @@ -42,9 +46,13 @@ void Browser::Quit() { } void Browser::Shutdown() { - FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit()); + if (is_shutdown_) + return; + is_shutdown_ = true; is_quiting_ = true; + + FOR_EACH_OBSERVER(BrowserObserver, observers_, OnQuit()); base::MessageLoop::current()->PostTask( FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); } @@ -121,6 +129,9 @@ void Browser::ClientCertificateSelector( } void Browser::NotifyAndShutdown() { + if (is_shutdown_) + return; + bool prevent_default = false; FOR_EACH_OBSERVER(BrowserObserver, observers_, OnWillQuit(&prevent_default)); diff --git a/atom/browser/browser.h b/atom/browser/browser.h index d135556b87..3c5abd2f04 100644 --- a/atom/browser/browser.h +++ b/atom/browser/browser.h @@ -159,6 +159,9 @@ class Browser : public WindowListObserver { // Whether "ready" event has been emitted. bool is_ready_; + // The browse is being shutdown. + bool is_shutdown_; + std::string version_override_; std::string name_override_; From 0e131f760b63ad199c5fffa13b2d422cf3bb5e26 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 4 Oct 2015 19:21:36 +0800 Subject: [PATCH 53/65] Quit gracefully when Ctrl-C is pressed --- atom/browser/atom_browser_main_parts.cc | 12 + atom/browser/atom_browser_main_parts.h | 8 + atom/browser/atom_browser_main_parts_posix.cc | 225 ++++++++++++++++++ filenames.gypi | 1 + 4 files changed, 246 insertions(+) create mode 100644 atom/browser/atom_browser_main_parts_posix.cc diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index 1b46247c49..e70d42fc76 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -52,6 +52,12 @@ void AtomBrowserMainParts::RegisterDestructionCallback( destruction_callbacks_.push_back(callback); } +void AtomBrowserMainParts::PreEarlyInitialization() { +#if defined(OS_POSIX) + HandleSIGCHLD(); +#endif +} + void AtomBrowserMainParts::PostEarlyInitialization() { brightray::BrowserMainParts::PostEarlyInitialization(); @@ -112,6 +118,12 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() { #endif } +void AtomBrowserMainParts::PostMainMessageLoopStart() { +#if defined(OS_POSIX) + HandleShutdownSignals(); +#endif +} + void AtomBrowserMainParts::PostMainMessageLoopRun() { brightray::BrowserMainParts::PostMainMessageLoopRun(); diff --git a/atom/browser/atom_browser_main_parts.h b/atom/browser/atom_browser_main_parts.h index 9fefa486a1..65b142157d 100644 --- a/atom/browser/atom_browser_main_parts.h +++ b/atom/browser/atom_browser_main_parts.h @@ -39,8 +39,10 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts { protected: // content::BrowserMainParts: + void PreEarlyInitialization() override; void PostEarlyInitialization() override; void PreMainMessageLoopRun() override; + void PostMainMessageLoopStart() override; void PostMainMessageLoopRun() override; #if defined(OS_MACOSX) void PreMainMessageLoopStart() override; @@ -48,6 +50,12 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts { #endif private: +#if defined(OS_POSIX) + // Set signal handlers. + void HandleSIGCHLD(); + void HandleShutdownSignals(); +#endif + // A fake BrowserProcess object that used to feed the source code from chrome. scoped_ptr fake_browser_process_; diff --git a/atom/browser/atom_browser_main_parts_posix.cc b/atom/browser/atom_browser_main_parts_posix.cc new file mode 100644 index 0000000000..ea0f87b171 --- /dev/null +++ b/atom/browser/atom_browser_main_parts_posix.cc @@ -0,0 +1,225 @@ +// Copyright (c) 2015 GitHub, Inc. +// Use of this source code is governed by the MIT license that can be +// found in the LICENSE file. + +// Most code came from: chrome/browser/chrome_browser_main_posix.cc. + +#include "atom/browser/atom_browser_main_parts.h" + +#include +#include +#include +#include +#include +#include + +#include "atom/browser/browser.h" +#include "base/posix/eintr_wrapper.h" +#include "content/public/browser/browser_thread.h" + +using content::BrowserThread; + +namespace atom { + +namespace { + +// See comment in |PreEarlyInitialization()|, where sigaction is called. +void SIGCHLDHandler(int signal) { +} + +// The OSX fork() implementation can crash in the child process before +// fork() returns. In that case, the shutdown pipe will still be +// shared with the parent process. To prevent child crashes from +// causing parent shutdowns, |g_pipe_pid| is the pid for the process +// which registered |g_shutdown_pipe_write_fd|. +// See . +pid_t g_pipe_pid = -1; +int g_shutdown_pipe_write_fd = -1; +int g_shutdown_pipe_read_fd = -1; + +// Common code between SIG{HUP, INT, TERM}Handler. +void GracefulShutdownHandler(int signal) { + // Reinstall the default handler. We had one shot at graceful shutdown. + struct sigaction action; + memset(&action, 0, sizeof(action)); + action.sa_handler = SIG_DFL; + RAW_CHECK(sigaction(signal, &action, NULL) == 0); + + RAW_CHECK(g_pipe_pid == getpid()); + RAW_CHECK(g_shutdown_pipe_write_fd != -1); + RAW_CHECK(g_shutdown_pipe_read_fd != -1); + size_t bytes_written = 0; + do { + int rv = HANDLE_EINTR( + write(g_shutdown_pipe_write_fd, + reinterpret_cast(&signal) + bytes_written, + sizeof(signal) - bytes_written)); + RAW_CHECK(rv >= 0); + bytes_written += rv; + } while (bytes_written < sizeof(signal)); +} + +// See comment in |PostMainMessageLoopStart()|, where sigaction is called. +void SIGHUPHandler(int signal) { + RAW_CHECK(signal == SIGHUP); + GracefulShutdownHandler(signal); +} + +// See comment in |PostMainMessageLoopStart()|, where sigaction is called. +void SIGINTHandler(int signal) { + RAW_CHECK(signal == SIGINT); + GracefulShutdownHandler(signal); +} + +// See comment in |PostMainMessageLoopStart()|, where sigaction is called. +void SIGTERMHandler(int signal) { + RAW_CHECK(signal == SIGTERM); + GracefulShutdownHandler(signal); +} + +class ShutdownDetector : public base::PlatformThread::Delegate { + public: + explicit ShutdownDetector(int shutdown_fd); + + void ThreadMain() override; + + private: + const int shutdown_fd_; + + DISALLOW_COPY_AND_ASSIGN(ShutdownDetector); +}; + +ShutdownDetector::ShutdownDetector(int shutdown_fd) + : shutdown_fd_(shutdown_fd) { + CHECK_NE(shutdown_fd_, -1); +} + +// These functions are used to help us diagnose crash dumps that happen +// during the shutdown process. +NOINLINE void ShutdownFDReadError() { + // Ensure function isn't optimized away. + asm(""); + sleep(UINT_MAX); +} + +NOINLINE void ShutdownFDClosedError() { + // Ensure function isn't optimized away. + asm(""); + sleep(UINT_MAX); +} + +NOINLINE void ExitPosted() { + // Ensure function isn't optimized away. + asm(""); + sleep(UINT_MAX); +} + +void ShutdownDetector::ThreadMain() { + base::PlatformThread::SetName("CrShutdownDetector"); + + int signal; + size_t bytes_read = 0; + ssize_t ret; + do { + ret = HANDLE_EINTR( + read(shutdown_fd_, + reinterpret_cast(&signal) + bytes_read, + sizeof(signal) - bytes_read)); + if (ret < 0) { + NOTREACHED() << "Unexpected error: " << strerror(errno); + ShutdownFDReadError(); + break; + } else if (ret == 0) { + NOTREACHED() << "Unexpected closure of shutdown pipe."; + ShutdownFDClosedError(); + break; + } + bytes_read += ret; + } while (bytes_read < sizeof(signal)); + VLOG(1) << "Handling shutdown for signal " << signal << "."; + base::Closure task = + base::Bind(&Browser::Quit, base::Unretained(Browser::Get())); + + if (!BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, task)) { + // Without a UI thread to post the exit task to, there aren't many + // options. Raise the signal again. The default handler will pick it up + // and cause an ungraceful exit. + RAW_LOG(WARNING, "No UI thread, exiting ungracefully."); + kill(getpid(), signal); + + // The signal may be handled on another thread. Give that a chance to + // happen. + sleep(3); + + // We really should be dead by now. For whatever reason, we're not. Exit + // immediately, with the exit status set to the signal number with bit 8 + // set. On the systems that we care about, this exit status is what is + // normally used to indicate an exit by this signal's default handler. + // This mechanism isn't a de jure standard, but even in the worst case, it + // should at least result in an immediate exit. + RAW_LOG(WARNING, "Still here, exiting really ungracefully."); + _exit(signal | (1 << 7)); + } + ExitPosted(); +} + +} // namespace + +void AtomBrowserMainParts::HandleSIGCHLD() { + // We need to accept SIGCHLD, even though our handler is a no-op because + // otherwise we cannot wait on children. (According to POSIX 2001.) + struct sigaction action; + memset(&action, 0, sizeof(action)); + action.sa_handler = SIGCHLDHandler; + CHECK(sigaction(SIGCHLD, &action, NULL) == 0); +} + +void AtomBrowserMainParts::HandleShutdownSignals() { + int pipefd[2]; + int ret = pipe(pipefd); + if (ret < 0) { + PLOG(DFATAL) << "Failed to create pipe"; + } else { + g_pipe_pid = getpid(); + g_shutdown_pipe_read_fd = pipefd[0]; + g_shutdown_pipe_write_fd = pipefd[1]; +#if !defined(ADDRESS_SANITIZER) && !defined(KEEP_SHADOW_STACKS) + const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2; +#else + // ASan instrumentation and -finstrument-functions (used for keeping the + // shadow stacks) bloat the stack frames, so we need to increase the stack + // size to avoid hitting the guard page. + const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4; +#endif + // TODO(viettrungluu,willchan): crbug.com/29675 - This currently leaks, so + // if you change this, you'll probably need to change the suppression. + if (!base::PlatformThread::CreateNonJoinable( + kShutdownDetectorThreadStackSize, + new ShutdownDetector(g_shutdown_pipe_read_fd))) { + LOG(DFATAL) << "Failed to create shutdown detector task."; + } + } + // Setup signal handlers for shutdown AFTER shutdown pipe is setup because + // it may be called right away after handler is set. + + // If adding to this list of signal handlers, note the new signal probably + // needs to be reset in child processes. See + // base/process_util_posix.cc:LaunchProcess. + + // We need to handle SIGTERM, because that is how many POSIX-based distros ask + // processes to quit gracefully at shutdown time. + struct sigaction action; + memset(&action, 0, sizeof(action)); + action.sa_handler = SIGTERMHandler; + CHECK(sigaction(SIGTERM, &action, NULL) == 0); + // Also handle SIGINT - when the user terminates the browser via Ctrl+C. If + // the browser process is being debugged, GDB will catch the SIGINT first. + action.sa_handler = SIGINTHandler; + CHECK(sigaction(SIGINT, &action, NULL) == 0); + // And SIGHUP, for when the terminal disappears. On shutdown, many Linux + // distros send SIGHUP, SIGTERM, and then SIGKILL. + action.sa_handler = SIGHUPHandler; + CHECK(sigaction(SIGHUP, &action, NULL) == 0); +} + +} // namespace atom diff --git a/filenames.gypi b/filenames.gypi index eb94973e01..04b82992bc 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -125,6 +125,7 @@ 'atom/browser/atom_browser_main_parts.cc', 'atom/browser/atom_browser_main_parts.h', 'atom/browser/atom_browser_main_parts_mac.mm', + 'atom/browser/atom_browser_main_parts_posix.cc', 'atom/browser/atom_javascript_dialog_manager.cc', 'atom/browser/atom_javascript_dialog_manager.h', 'atom/browser/atom_quota_permission_context.cc', From a2a4970f5f6601c6e8b713e6fe342ea63d78b022 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 4 Oct 2015 19:36:41 +0800 Subject: [PATCH 54/65] Fix cpplint warnings --- atom/browser/atom_browser_main_parts_posix.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/atom/browser/atom_browser_main_parts_posix.cc b/atom/browser/atom_browser_main_parts_posix.cc index ea0f87b171..2a0dddc474 100644 --- a/atom/browser/atom_browser_main_parts_posix.cc +++ b/atom/browser/atom_browser_main_parts_posix.cc @@ -171,7 +171,7 @@ void AtomBrowserMainParts::HandleSIGCHLD() { struct sigaction action; memset(&action, 0, sizeof(action)); action.sa_handler = SIGCHLDHandler; - CHECK(sigaction(SIGCHLD, &action, NULL) == 0); + CHECK_EQ(sigaction(SIGCHLD, &action, NULL), 0); } void AtomBrowserMainParts::HandleShutdownSignals() { @@ -211,15 +211,15 @@ void AtomBrowserMainParts::HandleShutdownSignals() { struct sigaction action; memset(&action, 0, sizeof(action)); action.sa_handler = SIGTERMHandler; - CHECK(sigaction(SIGTERM, &action, NULL) == 0); + CHECK_EQ(sigaction(SIGTERM, &action, NULL), 0); // Also handle SIGINT - when the user terminates the browser via Ctrl+C. If // the browser process is being debugged, GDB will catch the SIGINT first. action.sa_handler = SIGINTHandler; - CHECK(sigaction(SIGINT, &action, NULL) == 0); + CHECK_EQ(sigaction(SIGINT, &action, NULL), 0); // And SIGHUP, for when the terminal disappears. On shutdown, many Linux // distros send SIGHUP, SIGTERM, and then SIGKILL. action.sa_handler = SIGHUPHandler; - CHECK(sigaction(SIGHUP, &action, NULL) == 0); + CHECK_EQ(sigaction(SIGHUP, &action, NULL), 0); } } // namespace atom From d4bfeff6ad1686feb4a815096bb7890230a73a01 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 4 Oct 2015 20:08:19 +0800 Subject: [PATCH 55/65] Fix crashing on Linux --- atom/browser/atom_browser_main_parts.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index e70d42fc76..4c11176997 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -53,6 +53,7 @@ void AtomBrowserMainParts::RegisterDestructionCallback( } void AtomBrowserMainParts::PreEarlyInitialization() { + brightray::BrowserMainParts::PreEarlyInitialization(); #if defined(OS_POSIX) HandleSIGCHLD(); #endif @@ -119,6 +120,7 @@ void AtomBrowserMainParts::PreMainMessageLoopRun() { } void AtomBrowserMainParts::PostMainMessageLoopStart() { + brightray::BrowserMainParts::PostMainMessageLoopStart(); #if defined(OS_POSIX) HandleShutdownSignals(); #endif From 3d4318e15e757cf26377637ee1240d5b87cde39c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 4 Oct 2015 21:19:44 +0800 Subject: [PATCH 56/65] docs: Remove `cache` and `userCache` dir Closes #1404. --- docs/api/app.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/api/app.md b/docs/api/app.md index e4a8d561e2..0b5780aab7 100644 --- a/docs/api/app.md +++ b/docs/api/app.md @@ -197,12 +197,6 @@ You can request the following paths by the name: * `~/Library/Application Support` on OS X * `userData` The directory for storing your app's configuration files, which by default it is the `appData` directory appended with your app's name. -* `cache` Per-user application cache directory, which by default points to: - * `%APPDATA%` on Windows (which doesn't have a universal cache location) - * `$XDG_CACHE_HOME` or `~/.cache` on Linux - * `~/Library/Caches` on OS X -* `userCache` The directory for placing your app's caches, by default it is the - `cache` directory appended with your app's name. * `temp` Temporary directory. * `userDesktop` The current user's Desktop directory. * `exe` The current executable file. From ca6f6880139670e560157ebaa812cdf73afdeb0a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sun, 4 Oct 2015 22:19:05 +0800 Subject: [PATCH 57/65] Update brightray for #877 --- vendor/brightray | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/brightray b/vendor/brightray index bbb9287337..c44f99278b 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit bbb9287337f8b7958b001be35b993c21cd573109 +Subproject commit c44f99278bc4f6823f81b6f3a8d75881d697fd01 From 4d02fc58fa183c13273888cc30a874abaee52238 Mon Sep 17 00:00:00 2001 From: Eran Tiktin Date: Mon, 5 Oct 2015 03:29:02 +0300 Subject: [PATCH 58/65] Fix restore/unmaximize wrong window size This resolves #2498. --- atom/browser/native_window_views.cc | 46 +++++++++++++++++++---------- atom/browser/native_window_views.h | 6 ++++ 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index e9db97e195..7117142cf0 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -283,6 +283,8 @@ NativeWindowViews::NativeWindowViews( else last_window_state_ = ui::SHOW_STATE_NORMAL; + last_normal_size_ = gfx::Size(widget_size_); + if (!has_frame()) { // Set Window style so that we get a minimize and maximize animation when // frameless. @@ -851,23 +853,35 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) { NotifyWindowMinimize(); break; case SIZE_RESTORED: - if (last_window_state_ == ui::SHOW_STATE_NORMAL) - return; - - switch (last_window_state_) { - case ui::SHOW_STATE_MAXIMIZED: - last_window_state_ = ui::SHOW_STATE_NORMAL; - NotifyWindowUnmaximize(); - break; - case ui::SHOW_STATE_MINIMIZED: - if (IsFullscreen()) { - last_window_state_ = ui::SHOW_STATE_FULLSCREEN; - NotifyWindowEnterFullScreen(); - } else { + if (last_window_state_ == ui::SHOW_STATE_NORMAL) { + // Window was resized so we save it's new size. + last_normal_size_ = GetSize(); + } else { + switch (last_window_state_) { + case ui::SHOW_STATE_MAXIMIZED: last_window_state_ = ui::SHOW_STATE_NORMAL; - NotifyWindowRestore(); - } - break; + + // When the window is restored we resize it to the previous known + // normal size. + NativeWindow::SetSize(last_normal_size_); + + NotifyWindowUnmaximize(); + break; + case ui::SHOW_STATE_MINIMIZED: + if (IsFullscreen()) { + last_window_state_ = ui::SHOW_STATE_FULLSCREEN; + NotifyWindowEnterFullScreen(); + } else { + last_window_state_ = ui::SHOW_STATE_NORMAL; + + // When the window is restored we resize it to the previous known + // normal size. + NativeWindow::SetSize(last_normal_size_); + + NotifyWindowRestore(); + } + break; + } } break; } diff --git a/atom/browser/native_window_views.h b/atom/browser/native_window_views.h index 71e122d381..f93a9e2f7f 100644 --- a/atom/browser/native_window_views.h +++ b/atom/browser/native_window_views.h @@ -176,6 +176,12 @@ class NativeWindowViews : public NativeWindow, ui::WindowShowState last_window_state_; + // There's an issue with restore on Windows, that sometimes causes the Window + // to receive the wrong size (#2498). To circumvent that, we keep tabs on the + // size of the window while in the normal state (not maximized, minimized or + // fullscreen), so we restore it correctly. + gfx::Size last_normal_size_; + // In charge of running taskbar related APIs. TaskbarHost taskbar_host_; #endif From c34c123b338df7a8a72cc14f0b032eae223800ac Mon Sep 17 00:00:00 2001 From: Eran Tiktin Date: Mon, 5 Oct 2015 04:01:25 +0300 Subject: [PATCH 59/65] Make it work only on Windows Limiting the solution to Windows only. --- atom/browser/ui/views/frameless_view.cc | 8 ++------ atom/browser/ui/views/win_frame_view.cc | 6 ++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/atom/browser/ui/views/frameless_view.cc b/atom/browser/ui/views/frameless_view.cc index e8d351ec82..03a31e0828 100644 --- a/atom/browser/ui/views/frameless_view.cc +++ b/atom/browser/ui/views/frameless_view.cc @@ -104,15 +104,11 @@ gfx::Size FramelessView::GetPreferredSize() const { } gfx::Size FramelessView::GetMinimumSize() const { - gfx::Size size = window_->WindowSizeToFramelessSize( - window_->GetMinimumSize()); - return size; + return window_->GetMinimumSize(); } gfx::Size FramelessView::GetMaximumSize() const { - gfx::Size size = window_->WindowSizeToFramelessSize( - window_->GetMaximumSize()); - return size; + return window_->GetMaximumSize(); } const char* FramelessView::GetClassName() const { diff --git a/atom/browser/ui/views/win_frame_view.cc b/atom/browser/ui/views/win_frame_view.cc index db74661932..d0338af19d 100644 --- a/atom/browser/ui/views/win_frame_view.cc +++ b/atom/browser/ui/views/win_frame_view.cc @@ -40,12 +40,14 @@ int WinFrameView::NonClientHitTest(const gfx::Point& point) { } gfx::Size WinFrameView::GetMinimumSize() const { - gfx::Size size = FramelessView::GetMinimumSize(); + gfx::Size size = window_->WindowSizeToFramelessSize( + window_->GetMinimumSize()); return gfx::win::DIPToScreenSize(size); } gfx::Size WinFrameView::GetMaximumSize() const { - gfx::Size size = FramelessView::GetMaximumSize(); + gfx::Size size = window_->WindowSizeToFramelessSize( + window_->GetMaximumSize()); return gfx::win::DIPToScreenSize(size); } From 69140af0835d2d7aea8bbce632ae7fe9faa70bad Mon Sep 17 00:00:00 2001 From: hansrwindhoff Date: Sun, 4 Oct 2015 20:14:52 -0600 Subject: [PATCH 60/65] example code didn't run --- docs/api/screen.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/api/screen.md b/docs/api/screen.md index da15c7326f..9afbf02170 100644 --- a/docs/api/screen.md +++ b/docs/api/screen.md @@ -37,8 +37,8 @@ app.on('ready', function() { var electronScreen = require('screen'); var displays = electronScreen.getAllDisplays(); var externalDisplay = null; - for (var i in displays) { - if (displays[i].bounds.x > 0 || displays[i].bounds.y > 0) { + for (var i =0; i< displays.length; i++) { + if (displays[i].bounds.x !==0 || displays[i].bounds.y !== 0) { externalDisplay = displays[i]; break; } @@ -48,6 +48,8 @@ app.on('ready', function() { mainWindow = new BrowserWindow({ x: externalDisplay.bounds.x + 50, y: externalDisplay.bounds.y + 50, + width: 900, + height:600 }); } }); From 46c69cc3e5f76aee329a1b79847ac0f65818e5ee Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 5 Oct 2015 11:41:06 +0800 Subject: [PATCH 61/65] docs: Removed unneeded changes from PR --- docs/api/screen.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/api/screen.md b/docs/api/screen.md index 9afbf02170..3b6c276daf 100644 --- a/docs/api/screen.md +++ b/docs/api/screen.md @@ -37,8 +37,8 @@ app.on('ready', function() { var electronScreen = require('screen'); var displays = electronScreen.getAllDisplays(); var externalDisplay = null; - for (var i =0; i< displays.length; i++) { - if (displays[i].bounds.x !==0 || displays[i].bounds.y !== 0) { + for (var i in displays) { + if (displays[i].bounds.x != 0 || displays[i].bounds.y != 0) { externalDisplay = displays[i]; break; } @@ -48,8 +48,6 @@ app.on('ready', function() { mainWindow = new BrowserWindow({ x: externalDisplay.bounds.x + 50, y: externalDisplay.bounds.y + 50, - width: 900, - height:600 }); } }); From ad8e727ba251b559e48625680a50cc014f26b0e5 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 5 Oct 2015 11:41:36 +0800 Subject: [PATCH 62/65] docs: "loaded" event of "process" --- docs/api/process.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/api/process.md b/docs/api/process.md index abd3c4fe57..4e0fa4d602 100644 --- a/docs/api/process.md +++ b/docs/api/process.md @@ -9,7 +9,25 @@ upstream node: * `process.versions['chrome']` String - Version of Chromium. * `process.resourcesPath` String - Path to JavaScript source code. -# Methods +## Events + +### Event: 'loaded' + +Emitted when Electron has loaded its internal initialization script and is +beginning to load the web page or the main script. + +It can be used by the preload script to add removed Node global symbols back to +the global scope when node integration is turned off: + +```js +// preload.js +process.once('loaded', function() { + global.setImmediate = setImmediate; + global.clearImmediate = clearImmediate; +}); +``` + +## Methods The `process` object has the following method: @@ -17,7 +35,7 @@ The `process` object has the following method: Causes the main thread of the current process hang. -## process.setFdLimit(maxDescriptors) _OS X_ _Linux_ +### process.setFdLimit(maxDescriptors) _OS X_ _Linux_ * `maxDescriptors` Integer From ec0a8a13219a18989623878ed063449742a42bd6 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 5 Oct 2015 11:42:43 +0800 Subject: [PATCH 63/65] Bump v0.33.5 --- atom.gyp | 2 +- atom/browser/resources/mac/Info.plist | 2 +- atom/browser/resources/win/atom.rc | 8 ++++---- atom/common/atom_version.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/atom.gyp b/atom.gyp index b3c9e117a5..637e1c4795 100644 --- a/atom.gyp +++ b/atom.gyp @@ -4,7 +4,7 @@ 'product_name%': 'Electron', 'company_name%': 'GitHub, Inc', 'company_abbr%': 'github', - 'version%': '0.33.4', + 'version%': '0.33.5', }, 'includes': [ 'filenames.gypi', diff --git a/atom/browser/resources/mac/Info.plist b/atom/browser/resources/mac/Info.plist index b1b905a433..12934e6ef8 100644 --- a/atom/browser/resources/mac/Info.plist +++ b/atom/browser/resources/mac/Info.plist @@ -17,7 +17,7 @@ CFBundleIconFile atom.icns CFBundleVersion - 0.33.4 + 0.33.5 LSMinimumSystemVersion 10.8.0 NSMainNibFile diff --git a/atom/browser/resources/win/atom.rc b/atom/browser/resources/win/atom.rc index 6d900b0ea0..7a36dcdf35 100644 --- a/atom/browser/resources/win/atom.rc +++ b/atom/browser/resources/win/atom.rc @@ -56,8 +56,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,33,4,0 - PRODUCTVERSION 0,33,4,0 + FILEVERSION 0,33,5,0 + PRODUCTVERSION 0,33,5,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -74,12 +74,12 @@ BEGIN BEGIN VALUE "CompanyName", "GitHub, Inc." VALUE "FileDescription", "Electron" - VALUE "FileVersion", "0.33.4" + VALUE "FileVersion", "0.33.5" VALUE "InternalName", "electron.exe" VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved." VALUE "OriginalFilename", "electron.exe" VALUE "ProductName", "Electron" - VALUE "ProductVersion", "0.33.4" + VALUE "ProductVersion", "0.33.5" VALUE "SquirrelAwareVersion", "1" END END diff --git a/atom/common/atom_version.h b/atom/common/atom_version.h index 998e430881..42610f196e 100644 --- a/atom/common/atom_version.h +++ b/atom/common/atom_version.h @@ -7,7 +7,7 @@ #define ATOM_MAJOR_VERSION 0 #define ATOM_MINOR_VERSION 33 -#define ATOM_PATCH_VERSION 4 +#define ATOM_PATCH_VERSION 5 #define ATOM_VERSION_IS_RELEASE 1 From 7de3aa3cc1eef66a84df8d474954d4e2d81a1adb Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 5 Oct 2015 19:57:14 +0800 Subject: [PATCH 64/65] Fix typo, closes #2990 --- atom/browser/native_window_views.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atom/browser/native_window_views.cc b/atom/browser/native_window_views.cc index 4282b0eda9..689626fc5f 100644 --- a/atom/browser/native_window_views.cc +++ b/atom/browser/native_window_views.cc @@ -351,7 +351,7 @@ void NativeWindowViews::ShowInactive() { } void NativeWindowViews::Hide() { - web_contents()->WasHidden(); + window_->Hide(); } bool NativeWindowViews::IsVisible() { From 2d676770b12975daf1bbf67d0c758be04e03844f Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 5 Oct 2015 19:57:30 +0800 Subject: [PATCH 65/65] Bump v0.33.6 --- atom.gyp | 2 +- atom/browser/resources/mac/Info.plist | 2 +- atom/browser/resources/win/atom.rc | 8 ++++---- atom/common/atom_version.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/atom.gyp b/atom.gyp index 637e1c4795..f06a0c8251 100644 --- a/atom.gyp +++ b/atom.gyp @@ -4,7 +4,7 @@ 'product_name%': 'Electron', 'company_name%': 'GitHub, Inc', 'company_abbr%': 'github', - 'version%': '0.33.5', + 'version%': '0.33.6', }, 'includes': [ 'filenames.gypi', diff --git a/atom/browser/resources/mac/Info.plist b/atom/browser/resources/mac/Info.plist index 12934e6ef8..50e019c1c7 100644 --- a/atom/browser/resources/mac/Info.plist +++ b/atom/browser/resources/mac/Info.plist @@ -17,7 +17,7 @@ CFBundleIconFile atom.icns CFBundleVersion - 0.33.5 + 0.33.6 LSMinimumSystemVersion 10.8.0 NSMainNibFile diff --git a/atom/browser/resources/win/atom.rc b/atom/browser/resources/win/atom.rc index 7a36dcdf35..b1aba451dc 100644 --- a/atom/browser/resources/win/atom.rc +++ b/atom/browser/resources/win/atom.rc @@ -56,8 +56,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,33,5,0 - PRODUCTVERSION 0,33,5,0 + FILEVERSION 0,33,6,0 + PRODUCTVERSION 0,33,6,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -74,12 +74,12 @@ BEGIN BEGIN VALUE "CompanyName", "GitHub, Inc." VALUE "FileDescription", "Electron" - VALUE "FileVersion", "0.33.5" + VALUE "FileVersion", "0.33.6" VALUE "InternalName", "electron.exe" VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved." VALUE "OriginalFilename", "electron.exe" VALUE "ProductName", "Electron" - VALUE "ProductVersion", "0.33.5" + VALUE "ProductVersion", "0.33.6" VALUE "SquirrelAwareVersion", "1" END END diff --git a/atom/common/atom_version.h b/atom/common/atom_version.h index 42610f196e..8078551b90 100644 --- a/atom/common/atom_version.h +++ b/atom/common/atom_version.h @@ -7,7 +7,7 @@ #define ATOM_MAJOR_VERSION 0 #define ATOM_MINOR_VERSION 33 -#define ATOM_PATCH_VERSION 5 +#define ATOM_PATCH_VERSION 6 #define ATOM_VERSION_IS_RELEASE 1