2013-05-15 11:19:35 +00:00
|
|
|
EventEmitter = require('events').EventEmitter
|
2013-05-17 08:09:12 +00:00
|
|
|
v8Util = process.atomBinding 'v8_util'
|
2013-05-30 12:16:54 +00:00
|
|
|
objectsRegistry = require '../../atom/objects-registry.js'
|
2013-05-15 11:19:35 +00:00
|
|
|
|
2013-06-18 13:40:03 +00:00
|
|
|
BrowserWindow = process.atomBinding('window').BrowserWindow
|
|
|
|
BrowserWindow::__proto__ = EventEmitter.prototype
|
2013-05-17 08:09:12 +00:00
|
|
|
|
2013-06-18 13:40:03 +00:00
|
|
|
BrowserWindow::toggleDevTools = ->
|
|
|
|
opened = v8Util.getHiddenValue this, 'devtoolsOpened'
|
|
|
|
if opened
|
|
|
|
@closeDevTools()
|
|
|
|
v8Util.setHiddenValue this, 'devtoolsOpened', false
|
|
|
|
else
|
|
|
|
@openDevTools()
|
|
|
|
v8Util.setHiddenValue this, 'devtoolsOpened', true
|
2013-05-15 11:19:35 +00:00
|
|
|
|
2013-06-18 13:40:03 +00:00
|
|
|
BrowserWindow::restart = ->
|
|
|
|
@loadUrl(@getUrl())
|
2013-06-18 10:47:13 +00:00
|
|
|
|
2013-06-18 13:40:03 +00:00
|
|
|
BrowserWindow.getFocusedWindow = ->
|
|
|
|
windows = objectsRegistry.getAllWindows()
|
|
|
|
return window for window in windows when window.isFocused()
|
2013-05-28 08:01:44 +00:00
|
|
|
|
2013-06-18 13:40:03 +00:00
|
|
|
BrowserWindow.fromProcessIdAndRoutingId = (processId, routingId) ->
|
|
|
|
windows = objectsRegistry.getAllWindows()
|
|
|
|
return window for window in windows when window.getProcessId() == processId and
|
|
|
|
window.getRoutingId() == routingId
|
2013-05-16 15:00:43 +00:00
|
|
|
|
2013-06-18 13:40:03 +00:00
|
|
|
module.exports = BrowserWindow
|