Pass options in "new-window" event

This commit is contained in:
Cheng Zhao 2015-09-22 23:39:31 +08:00
parent d0d71efb0b
commit f2fa0e96eb
2 changed files with 5 additions and 4 deletions

View file

@ -22,7 +22,7 @@ createGuest = (embedder, url, frameName, options) ->
guest.loadUrl url
return guest.id
guest = new BrowserWindow(mergeBrowserWindowOptions(embedder, options))
guest = new BrowserWindow(options)
guest.loadUrl url
# Remember the embedder, will be used by window.opener methods.
@ -51,11 +51,12 @@ createGuest = (embedder, url, frameName, options) ->
# Routed window.open messages.
ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, args...) ->
[url, frameName, options] = args
event.sender.emit 'new-window', event, url, frameName, 'new-window'
options = mergeBrowserWindowOptions event.sender, options
event.sender.emit 'new-window', event, url, frameName, 'new-window', options
if (event.sender.isGuest() and not event.sender.allowPopups) or event.defaultPrevented
event.returnValue = null
else
event.returnValue = createGuest event.sender, args...
event.returnValue = createGuest event.sender, url, frameName, options
ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_CLOSE', (event, guestId) ->
BrowserWindow.fromId(guestId)?.destroy()

View file

@ -16,7 +16,7 @@ WEB_VIEW_EVENTS =
'did-get-redirect-request': ['oldUrl', 'newUrl', 'isMainFrame']
'dom-ready': []
'console-message': ['level', 'message', 'line', 'sourceId']
'new-window': ['url', 'frameName', 'disposition']
'new-window': ['url', 'frameName', 'disposition', 'options']
'close': []
'crashed': []
'gpu-crashed': []