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,10 +60,11 @@ 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
mate::WrappableBase* Menu::New(mate::Arguments* args) { mate::WrappableBase* Menu::New(mate::Arguments* args) {

View file

@ -653,7 +653,8 @@ 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",
std::make_pair(params, web_contents()),
base::Bind(&content::WebContents::NotifyContextMenuClosed, base::Bind(&content::WebContents::NotifyContextMenuClosed,
base::Unretained(web_contents()), params.custom_context)); base::Unretained(web_contents()), params.custom_context));
} else { } else {

View file

@ -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.