diff options
Diffstat (limited to 'lib/web_contents_view_qt.cpp')
-rw-r--r-- | lib/web_contents_view_qt.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/web_contents_view_qt.cpp b/lib/web_contents_view_qt.cpp index 340075c9a..8fc7f5b12 100644 --- a/lib/web_contents_view_qt.cpp +++ b/lib/web_contents_view_qt.cpp @@ -48,6 +48,7 @@ #include "base/command_line.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/public/common/content_switches.h" +#include "content/public/common/context_menu_params.h" void WebContentsViewQt::initialize(WebContentsAdapterClient* client) { @@ -111,3 +112,19 @@ void WebContentsViewQt::SetInitialFocus() { Focus(); } + +static WebEngineContextMenuData fromParams(const content::ContextMenuParams ¶ms) +{ + WebEngineContextMenuData ret; + ret.pos = QPoint(params.x, params.y); + ret.linkUrl = toQt(params.link_url); + ret.linkText = toQt(params.link_text.data()); + ret.selectedText = toQt(params.selection_text.data()); + return ret; +} + +void WebContentsViewQt::ShowContextMenu(const content::ContextMenuParams ¶ms) +{ + WebEngineContextMenuData contextMenuData(fromParams(params)); + m_client->contextMenuRequested(contextMenuData); +} |