Translate |disposition| to string

This commit is contained in:
Cheng Zhao 2014-11-04 18:12:57 +08:00
parent 013593ccf8
commit f29c7164f3
5 changed files with 16 additions and 5 deletions

View file

@ -25,7 +25,7 @@ BrowserWindow::_init = ->
enumerable: true
# Make new windows requested by links behave like "window.open"
@on 'new-window', (event, url, frameName) =>
@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

View file

@ -26,6 +26,17 @@ module.exports.wrap = (webContents) ->
webContents.getId = -> "#{@getProcessId()}-#{@getRoutingId()}"
webContents.equal = (other) -> @getId() is other.getId()
# Translate |disposition| to string for 'new-window' event.
webContents.on '-new-window', (args..., disposition) ->
disposition =
switch disposition
when 2 then 'default'
when 4 then 'foreground-tab'
when 5 then 'background-tab'
when 6, 7 then 'new-window'
else 'other'
@emit 'new-window', args..., disposition
# Tell the rpc server that a render view has been deleted and we need to
# release all objects owned by it.
webContents.on 'render-view-deleted', (event, processId, routingId) ->