Coding style fixes
This commit is contained in:
parent
5bf16c2495
commit
e4770c7604
3 changed files with 9 additions and 10 deletions
|
@ -60,9 +60,10 @@ void MenuViews::PopupAt(Window* window, int x, int y, int positioning_item) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuViews::ClosePopupAt(int32_t window_id) {
|
void MenuViews::ClosePopupAt(int32_t window_id) {
|
||||||
if (menu_runners_[window_id])
|
if (menu_runners_[window_id]) {
|
||||||
menu_runners_[window_id]->Cancel();
|
menu_runners_[window_id]->Cancel();
|
||||||
menu_runners_.erase(window_id);
|
menu_runners_.erase(window_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
|
@ -653,9 +653,10 @@ void WebContents::RendererResponsive(content::WebContents* source) {
|
||||||
|
|
||||||
bool WebContents::HandleContextMenu(const content::ContextMenuParams& params) {
|
bool WebContents::HandleContextMenu(const content::ContextMenuParams& params) {
|
||||||
if (params.custom_context.is_pepper_menu) {
|
if (params.custom_context.is_pepper_menu) {
|
||||||
Emit("pepper-context-menu", std::make_pair(params, web_contents()),
|
Emit("pepper-context-menu",
|
||||||
base::Bind(&content::WebContents::NotifyContextMenuClosed,
|
std::make_pair(params, web_contents()),
|
||||||
base::Unretained(web_contents()), params.custom_context));
|
base::Bind(&content::WebContents::NotifyContextMenuClosed,
|
||||||
|
base::Unretained(web_contents()), params.custom_context));
|
||||||
} else {
|
} else {
|
||||||
Emit("context-menu", std::make_pair(params, web_contents()));
|
Emit("context-menu", std::make_pair(params, web_contents()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,13 +278,10 @@ WebContents.prototype._init = function () {
|
||||||
|
|
||||||
// Handle context menu action request from pepper plugin.
|
// Handle context menu action request from pepper plugin.
|
||||||
this.on('pepper-context-menu', function (event, params, callback) {
|
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)
|
const menu = electron.Menu.buildFromTemplate(params.menu)
|
||||||
|
menu.once('closed', callback)
|
||||||
menu.popup(event.sender.getOwnerBrowserWindow(), params.x, params.y)
|
menu.popup(event.sender.getOwnerBrowserWindow(), params.x, params.y)
|
||||||
|
|
||||||
menu.on('closed', () => {
|
|
||||||
callback()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// The devtools requests the webContents to reload.
|
// The devtools requests the webContents to reload.
|
||||||
|
|
Loading…
Reference in a new issue