Call role method on focused web contents

This commit is contained in:
Kevin Sawicki 2016-07-13 12:18:44 -07:00
parent 06e595e7cc
commit f9a8bd3ea5
3 changed files with 10 additions and 16 deletions

View file

@ -115,7 +115,7 @@ exports.getDefaultAccelerator = (role) => {
if (roles.hasOwnProperty(role)) return roles[role].accelerator
}
exports.execute = (role, focusedWindow) => {
exports.execute = (role, focusedWindow, focusedWebContents) => {
if (!roles.hasOwnProperty(role)) return false
if (process.platform === 'darwin') return false
@ -135,15 +135,8 @@ exports.execute = (role, focusedWindow) => {
return true
}
if (webContentsMethod && focusedWindow != null) {
const {webContents} = focusedWindow
if (webContents) {
if (webContents.isDevToolsFocused()) {
webContents.devToolsWebContents[webContentsMethod]()
} else {
webContents[webContentsMethod]()
}
}
if (webContentsMethod && focusedWebContents != null) {
focusedWebContents[webContentsMethod]()
return true
}