}
// Note: WebContentsViewDelegate::ShowContextMenu is the hook called
-// by chromium in response to a long press gesture.
-// However, in EWK apps, browser enters in selection mode in response
-// to it.
+// by chromium in response to either a long press gesture (in case of
+// touch-based input event is the source) or a right button mouse click
+// (in case source is mouse-based).
+// For the former, EWK apps enter selection mode, whereas for the
+// later, context menu is shown right way.
void WebContentsViewDelegateEwk::ShowContextMenu(
content::RenderFrameHost* render_frame_host,
const content::ContextMenuParams& params) {
- web_view_->HandleLongPressGesture(params);
+
+ if (params.source_type == ui::MENU_SOURCE_TOUCH) {
+ CHECK(web_view_->TouchEventsEnabled());
+ web_view_->HandleLongPressGesture(params);
+ } else {
+ web_view_->ShowContextMenu(params);
+ }
}