Call window methods on AtomWindow when ipc'ing from render process

This enables saveState to be called when requesting a window reload from the render process.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
This commit is contained in:
Nathan Sobo
2016-09-22 11:41:57 -06:00
committed by Max Brunsfeld
parent 9ace7b899c
commit 50128949d4
2 changed files with 18 additions and 3 deletions

View File

@@ -293,9 +293,8 @@ class AtomApplication
win = BrowserWindow.fromWebContents(event.sender)
win.emit(command, args...)
@disposable.add ipcHelpers.on ipcMain, 'call-window-method', (event, method, args...) ->
win = BrowserWindow.fromWebContents(event.sender)
win[method](args...)
@disposable.add ipcHelpers.on ipcMain, 'call-window-method', (event, method, args...) =>
@windowForEvent(event)[method](args...)
@disposable.add ipcHelpers.on ipcMain, 'pick-folder', (event, responseChannel) =>
@promptForPath "folder", (selectedPaths) ->

View File

@@ -236,8 +236,14 @@ class AtomWindow
maximize: -> @browserWindow.maximize()
unmaximize: -> @browserWindow.unmaximize()
restore: -> @browserWindow.restore()
setFullScreen: (fullScreen) -> @browserWindow.setFullScreen(fullScreen)
setAutoHideMenuBar: (autoHideMenuBar) -> @browserWindow.setAutoHideMenuBar(autoHideMenuBar)
handlesAtomCommands: ->
not @isSpecWindow() and @isWebViewFocused()
@@ -257,3 +263,13 @@ class AtomWindow
@loadedPromise
toggleDevTools: -> @browserWindow.toggleDevTools()
openDevTools: -> @browserWindow.openDevTools()
closeDevTools: -> @browserWindow.openDevTools()
setDocumentEdited: (documentEdited) -> @browserWindow.setDocumentEdited(documentEdited)
setRepresentedFilename: (representedFilename) -> @browserWindow.setRepresentedFilename(representedFilename)
copy: -> @browserWindow.copy()