Remove Menu::AttachToWindow

It makes the logic more complex without any benefit
This commit is contained in:
Cheng Zhao 2015-06-04 15:32:33 +08:00
parent 6d6e75795f
commit 47e9deeb9a
5 changed files with 35 additions and 10 deletions

View file

@ -70,13 +70,10 @@ BrowserWindow::getDevToolsWebContents = ->
wrapWebContents @_getDevToolsWebContents()
BrowserWindow::setMenu = (menu) ->
if process.platform is 'darwin'
throw new Error('BrowserWindow.setMenu is not available on OS X')
throw new TypeError('Invalid menu') unless menu is null or menu?.constructor?.name is 'Menu'
@menu = menu # Keep a reference of menu in case of GC.
@menu.attachToWindow this
@_setMenu menu
BrowserWindow.getAllWindows = ->
windows = BrowserWindow.windows