From db2f69bb58ab369e44ea8bb30dcdbe90660578a2 Mon Sep 17 00:00:00 2001 From: Szabolcs David Date: Thu, 20 Nov 2014 05:31:14 -0800 Subject: Widgets: Implement mouse lock permission API If the user grants the permission with mouse click on the feature permission bar, the RenderWidgetHostView loses the focus but the focus is necessary for the pointer lock. Change-Id: Ifafd86b472e400c5690194dce2ea8a829a51c313 Reviewed-by: Andras Becsi --- src/core/web_contents_adapter.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/core/web_contents_adapter.cpp') diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index dc20ea180..9398046d0 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -776,6 +776,20 @@ void WebContentsAdapter::runGeolocationRequestCallback(const QUrl &securityOrigi d->webContentsDelegate->m_lastGeolocationRequestCallbacks.first.Run(allowed); } +void WebContentsAdapter::grantMouseLockPermission(bool granted) +{ + Q_D(WebContentsAdapter); + + if (granted) { + if (RenderWidgetHostViewQt *rwhv = static_cast(d->webContents->GetRenderWidgetHostView())) + rwhv->Focus(); + else + granted = false; + } + + d->webContents->GotResponseToLockMouseRequest(granted); +} + void WebContentsAdapter::dpiScaleChanged() { Q_D(WebContentsAdapter); -- cgit v1.2.3