Add BrowserWindow.fromProcessIdAndRoutingId API.

This commit is contained in:
Cheng Zhao 2013-05-17 21:53:37 +08:00
parent d356be9c54
commit 66c35e4517
2 changed files with 7 additions and 4 deletions

View file

@ -18,4 +18,9 @@ BrowserWindow.getFocusedWindow = ->
windows = objectsRegistry.getAllWindows()
return window for window in windows when window.isFocused()
BrowserWindow.fromProcessIdAndRoutingId = (processId, routingId) ->
windows = objectsRegistry.getAllWindows()
return window for window in windows when window.getProcessId() == processId and
window.getRoutingId() == routingId
module.exports = BrowserWindow

View file

@ -68,10 +68,8 @@ ipc.on 'ATOM_BROWSER_RELEASE_RENDER_VIEW', (event, processId, routingId) ->
ipc.on 'ATOM_BROWSER_CURRENT_WINDOW', (event, processId, routingId) ->
try
windows = objectsRegistry.getAllWindows()
for window in windows
break if window.getProcessId() == processId and
window.getRoutingId() == routingId
BrowserWindow = require 'browser_window'
window = BrowserWindow.fromProcessIdAndRoutingId processId, routingId
event.result = valueToMeta processId, routingId, window
catch e
event.result = errorToMeta e