Add 'context-menu' event to 'WebContents'

This commit is contained in:
Daniel Pham 2016-05-02 20:02:33 -04:00
parent d64e3784f4
commit 0fffbea79d
6 changed files with 166 additions and 4 deletions

View file

@ -440,11 +440,13 @@ void WebContents::RendererResponsive(content::WebContents* source) {
}
bool WebContents::HandleContextMenu(const content::ContextMenuParams& params) {
if (!params.custom_context.is_pepper_menu)
return false;
if (params.custom_context.is_pepper_menu) {
Emit("pepper-context-menu", std::make_pair(params, web_contents()));
web_contents()->NotifyContextMenuClosed(params.custom_context);
} else {
Emit("context-menu", std::make_pair(params, web_contents()));
}
Emit("pepper-context-menu", std::make_pair(params, web_contents()));
web_contents()->NotifyContextMenuClosed(params.custom_context);
return true;
}