Decouple WebContentsDelegate from NativeWindow

This commit is contained in:
Cheng Zhao 2015-06-25 11:07:23 +08:00
parent 5236b0c067
commit fb5fe7a714
10 changed files with 120 additions and 179 deletions

View file

@ -12,14 +12,13 @@ BrowserWindow::_init = ->
@setMenu menu if menu?
# Make new windows requested by links behave like "window.open"
@on '-new-window', (event, url, frameName) =>
event.sender = @webContents
@webContents.on '-new-window', (event, url, frameName) ->
options = show: true, width: 800, height: 600
ipc.emit 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', event, url, frameName, options
# Redirect "will-navigate" to webContents.
@on '-will-navigate', (event, url) =>
@webContents.emit 'will-navigate', event, url
# window.move(...)
@webContents.on 'move', (event, size) =>
@setSize size
# Redirect focus/blur event to app instance too.
@on 'blur', (event) =>