Add focus() and blur() for FakeWindow

This commit is contained in:
Cheng Zhao 2014-10-27 23:03:05 +08:00
parent 64ce44d341
commit bdad1d1753
2 changed files with 10 additions and 0 deletions

View file

@ -58,3 +58,7 @@ ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_OPEN', (event, args...) ->
ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_CLOSE', (event, args...) ->
guest = removeGuest args...
guest.destroy()
ipc.on 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_METHOD', (event, guestId, method, args...) ->
guest = BrowserWindow.windows.get guestId
guest[method] args...

View file

@ -9,6 +9,12 @@ class FakeWindow
close: ->
ipc.send 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_CLOSE', @embedderId, @guestId
focus: ->
ipc.send 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_METHOD', @guestId, 'focus'
blur: ->
ipc.send 'ATOM_SHELL_GUEST_WINDOW_MANAGER_WINDOW_METHOD', @guestId, 'blur'
unless process.guestInstanceId?
# Override default window.close.
window.close = ->