From cc9ff77dd2fd1ba13b4b545411e7d66276f34c79 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 27 Oct 2014 23:46:25 +0800 Subject: [PATCH] Make open window by default --- atom/browser/api/lib/browser-window.coffee | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/atom/browser/api/lib/browser-window.coffee b/atom/browser/api/lib/browser-window.coffee index a21499d788a3..7d27234d0a2a 100644 --- a/atom/browser/api/lib/browser-window.coffee +++ b/atom/browser/api/lib/browser-window.coffee @@ -1,6 +1,7 @@ EventEmitter = require('events').EventEmitter IDWeakMap = require 'id-weak-map' app = require 'app' +ipc = require 'ipc' wrapWebContents = require('web-contents').wrap BrowserWindow = process.atomBinding('window').BrowserWindow @@ -23,9 +24,11 @@ BrowserWindow::_init = -> value: BrowserWindow.windows.add(this) enumerable: true - # Route the "new-window" event to webContents. - @on 'new-window', (args...) => - @webContents?.emit 'new-window', args... + # Make new windows requested by links behave like "window.open" + @on 'new-window', (event, url, frameName) => + event.sender = @webContents + options = show: true, width: 800, height: 600 + ipc.emit 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', event, url, frameName, options # Remove the window from weak map immediately when it's destroyed, since we # could be iterating windows before GC happened.