From: Cheng Zhao Date: Mon, 27 Oct 2014 15:46:25 +0000 (+0800) Subject: Make open window by default X-Git-Tag: v0.19.0~1^2~4 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=cc9ff77dd2fd1ba13b4b545411e7d66276f34c79;p=electron.git Make open window by default --- diff --git a/atom/browser/api/lib/browser-window.coffee b/atom/browser/api/lib/browser-window.coffee index a21499d7..7d27234d 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.