Coding style fixes

This commit is contained in:
Cheng Zhao 2017-12-20 18:48:09 +09:00
parent 5bf16c2495
commit e4770c7604
3 changed files with 9 additions and 10 deletions

View file

@ -60,9 +60,10 @@ void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item) {
}
void MenuViews::ClosePopupAt(int32_t window_id) {
if (menu_runners_[window_id])
if (menu_runners_[window_id]) {
menu_runners_[window_id]->Cancel();
menu_runners_.erase(window_id);
}
}
// static

View file

@ -653,7 +653,8 @@ void WebContents::RendererResponsive(content::WebContents* source) {
bool WebContents::HandleContextMenu(const content::ContextMenuParams& params) {
if (params.custom_context.is_pepper_menu) {
Emit("pepper-context-menu", std::make_pair(params, web_contents()),
Emit("pepper-context-menu",
std::make_pair(params, web_contents()),
base::Bind(&content::WebContents::NotifyContextMenuClosed,
base::Unretained(web_contents()), params.custom_context));
} else {

View file

@ -278,13 +278,10 @@ WebContents.prototype._init = function () {
// Handle context menu action request from pepper plugin.
this.on('pepper-context-menu', function (event, params, callback) {
// Access Menu via electron.Menu to prevent circular require
// Access Menu via electron.Menu to prevent circular require.
const menu = electron.Menu.buildFromTemplate(params.menu)
menu.once('closed', callback)
menu.popup(event.sender.getOwnerBrowserWindow(), params.x, params.y)
menu.on('closed', () => {
callback()
})
})
// The devtools requests the webContents to reload.