summaryrefslogtreecommitdiffstats
path: root/src/webengine/api/qquickwebengineview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/webengine/api/qquickwebengineview.cpp')
-rw-r--r--src/webengine/api/qquickwebengineview.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 20610150..772befe1 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -343,6 +343,20 @@ void QQuickWebEngineViewPrivate::javaScriptConsoleMessage(JavaScriptConsoleMessa
Q_EMIT q->javaScriptConsoleMessage(static_cast<QQuickWebEngineView::JavaScriptConsoleMessageLevel>(level), message, lineNumber, sourceID);
}
+void QQuickWebEngineViewPrivate::runMediaAccessPermissionRequest(const QUrl &securityOrigin, WebContentsAdapterClient::MediaRequestFlags requestFlags)
+{
+ if (!requestFlags)
+ return;
+ QQuickWebEngineViewExperimental::Feature feature;
+ if (requestFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture) && requestFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture))
+ feature = QQuickWebEngineViewExperimental::MediaAudioVideoDevices;
+ else if (requestFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture))
+ feature = QQuickWebEngineViewExperimental::MediaAudioDevices;
+ else if (requestFlags.testFlag(WebContentsAdapterClient::MediaVideoCapture))
+ feature = QQuickWebEngineViewExperimental::MediaVideoDevices;
+ Q_EMIT e->featurePermissionRequested(securityOrigin, feature);
+}
+
void QQuickWebEngineViewPrivate::setDevicePixelRatio(qreal devicePixelRatio)
{
this->devicePixelRatio = devicePixelRatio;
@@ -541,6 +555,27 @@ QQuickWebEngineHistory *QQuickWebEngineViewExperimental::navigationHistory() con
return d_ptr->m_history.data();
}
+void QQuickWebEngineViewExperimental::grantFeaturePermission(const QUrl &securityOrigin, QQuickWebEngineViewExperimental::Feature feature, bool granted)
+{
+ if (!granted && feature >= MediaAudioDevices && feature <= MediaAudioVideoDevices) {
+ d_ptr->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaNone);
+ return;
+ }
+
+ switch (feature) {
+ case MediaAudioDevices:
+ d_ptr->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaAudioCapture);
+ break;
+ case MediaVideoDevices:
+ d_ptr->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaVideoCapture);
+ break;
+ case MediaAudioVideoDevices:
+ d_ptr->adapter->grantMediaAccessPermission(securityOrigin, WebContentsAdapterClient::MediaRequestFlags(WebContentsAdapterClient::MediaAudioCapture
+ | WebContentsAdapterClient::MediaVideoCapture));
+ break;
+ }
+}
+
void QQuickWebEngineViewExperimental::goBackTo(int index)
{
int count = d_ptr->adapter->currentNavigationEntryIndex();