diff options
Diffstat (limited to 'src/core/web_contents_view_qt.cpp')
-rw-r--r-- | src/core/web_contents_view_qt.cpp | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp index 7177a8713..ef7c09665 100644 --- a/src/core/web_contents_view_qt.cpp +++ b/src/core/web_contents_view_qt.cpp @@ -55,6 +55,7 @@ #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/web_contents/web_contents_impl.h" +#include "content/public/browser/web_contents_delegate.h" #include "content/public/common/context_menu_params.h" #include "ui/gfx/image/image_skia.h" @@ -141,6 +142,22 @@ void WebContentsViewQt::SetInitialFocus() Focus(); } +void WebContentsViewQt::FocusThroughTabTraversal(bool reverse) +{ + content::WebContentsImpl *web_contents = static_cast<content::WebContentsImpl*>(m_webContents); + if (web_contents->ShowingInterstitialPage()) { + web_contents->GetInterstitialPage()->FocusThroughTabTraversal(reverse); + return; + } + content::RenderWidgetHostView *fullscreen_view = web_contents->GetFullscreenRenderWidgetHostView(); + if (fullscreen_view) { + fullscreen_view->Focus(); + return; + } + web_contents->GetRenderViewHost()->SetInitialFocus(reverse); +} + + ASSERT_ENUMS_MATCH(WebEngineContextMenuData::MediaTypeNone, blink::WebContextMenuData::kMediaTypeNone) ASSERT_ENUMS_MATCH(WebEngineContextMenuData::MediaTypeImage, blink::WebContextMenuData::kMediaTypeImage) ASSERT_ENUMS_MATCH(WebEngineContextMenuData::MediaTypeVideo, blink::WebContextMenuData::kMediaTypeVideo) @@ -265,25 +282,22 @@ void WebContentsViewQt::UpdateDragCursor(blink::WebDragOperation dragOperation) #endif // QT_CONFIG(draganddrop) } -void WebContentsViewQt::TakeFocus(bool reverse) +void WebContentsViewQt::GotFocus(content::RenderWidgetHostImpl* render_widget_host) { - m_client->passOnFocus(reverse); + content::WebContentsImpl *web_contents = static_cast<content::WebContentsImpl*>(m_webContents); + web_contents->NotifyWebContentsFocused(render_widget_host); } -void WebContentsViewQt::FocusThroughTabTraversal(bool reverse) +void WebContentsViewQt::LostFocus(content::RenderWidgetHostImpl* render_widget_host) { content::WebContentsImpl *web_contents = static_cast<content::WebContentsImpl*>(m_webContents); - if (web_contents->ShowingInterstitialPage()) { - web_contents->GetInterstitialPage()->FocusThroughTabTraversal(reverse); - return; - } - content::RenderWidgetHostView *fullscreen_view = web_contents->GetFullscreenRenderWidgetHostView(); - if (fullscreen_view) { - fullscreen_view->Focus(); - return; - } - web_contents->GetRenderViewHost()->SetInitialFocus(reverse); + web_contents->NotifyWebContentsLostFocus(render_widget_host); } +void WebContentsViewQt::TakeFocus(bool reverse) +{ + if (m_webContents->GetDelegate()) + m_webContents->GetDelegate()->TakeFocus(m_webContents, reverse); +} } // namespace QtWebEngineCore |