From fa7f0846255a5cb46554f7b12eda55938e1c5c6b Mon Sep 17 00:00:00 2001 From: Felix Rieseberg Date: Thu, 26 May 2016 09:35:26 -0700 Subject: [PATCH 1/2] :fax: Add print() to BrowserWindowProxy Closes #5685 --- docs/api/window-open.md | 4 ++++ lib/renderer/override.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/api/window-open.md b/docs/api/window-open.md index 7f9400bfae..b615a4b648 100644 --- a/docs/api/window-open.md +++ b/docs/api/window-open.md @@ -63,6 +63,10 @@ Evaluates the code in the child window. Focuses the child window (brings the window to front). +### `BrowserWindowProxy.print()` + +Invokes the print dialog on the child window. + ### `BrowserWindowProxy.postMessage(message, targetOrigin)` * `message` String diff --git a/lib/renderer/override.js b/lib/renderer/override.js index 35ca80f16a..4f0b861dc9 100644 --- a/lib/renderer/override.js +++ b/lib/renderer/override.js @@ -45,6 +45,10 @@ var BrowserWindowProxy = (function () { return ipcRenderer.send('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_METHOD', this.guestId, 'blur') } + BrowserWindowProxy.prototype.print = function () { + return ipcRenderer.send('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_METHOD', this.guestId, 'print') + } + Object.defineProperty(BrowserWindowProxy.prototype, 'location', { get: function () { return ipcRenderer.sendSync('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_METHOD', this.guestId, 'getURL') From 84f6015037263a0e2ce78203587d6ec361089699 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Fri, 27 May 2016 11:11:55 -0700 Subject: [PATCH 2/2] Call print on webContents --- lib/renderer/override.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/renderer/override.js b/lib/renderer/override.js index 4f0b861dc9..5667e5e16f 100644 --- a/lib/renderer/override.js +++ b/lib/renderer/override.js @@ -46,7 +46,7 @@ var BrowserWindowProxy = (function () { } BrowserWindowProxy.prototype.print = function () { - return ipcRenderer.send('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_METHOD', this.guestId, 'print') + return ipcRenderer.send('ELECTRON_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD', this.guestId, 'print') } Object.defineProperty(BrowserWindowProxy.prototype, 'location', {