summaryrefslogtreecommitdiffstats
path: root/examples/webenginewidgets/simplebrowser/webview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/webenginewidgets/simplebrowser/webview.cpp')
-rw-r--r--examples/webenginewidgets/simplebrowser/webview.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/examples/webenginewidgets/simplebrowser/webview.cpp b/examples/webenginewidgets/simplebrowser/webview.cpp
index 08e044f70..3dcfc0c47 100644
--- a/examples/webenginewidgets/simplebrowser/webview.cpp
+++ b/examples/webenginewidgets/simplebrowser/webview.cpp
@@ -71,26 +71,26 @@ WebView::~WebView()
m_imageAnimationGroup = nullptr;
}
-inline QString questionForFeature(QWebEnginePage::Feature feature)
+inline QString questionForFeature(QWebEnginePermission::Feature feature)
{
switch (feature) {
- case QWebEnginePage::Geolocation:
+ case QWebEnginePermission::Geolocation:
return QObject::tr("Allow %1 to access your location information?");
- case QWebEnginePage::MediaAudioCapture:
+ case QWebEnginePermission::MediaAudioCapture:
return QObject::tr("Allow %1 to access your microphone?");
- case QWebEnginePage::MediaVideoCapture:
+ case QWebEnginePermission::MediaVideoCapture:
return QObject::tr("Allow %1 to access your webcam?");
- case QWebEnginePage::MediaAudioVideoCapture:
+ case QWebEnginePermission::MediaAudioVideoCapture:
return QObject::tr("Allow %1 to access your microphone and webcam?");
- case QWebEnginePage::MouseLock:
+ case QWebEnginePermission::MouseLock:
return QObject::tr("Allow %1 to lock your mouse cursor?");
- case QWebEnginePage::DesktopVideoCapture:
+ case QWebEnginePermission::DesktopVideoCapture:
return QObject::tr("Allow %1 to capture video of your desktop?");
- case QWebEnginePage::DesktopAudioVideoCapture:
+ case QWebEnginePermission::DesktopAudioVideoCapture:
return QObject::tr("Allow %1 to capture audio and video of your desktop?");
- case QWebEnginePage::Notifications:
+ case QWebEnginePermission::Notifications:
return QObject::tr("Allow %1 to show notification on your desktop?");
- case QWebEnginePage::ClipboardReadWrite:
+ case QWebEnginePermission::ClipboardReadWrite:
return QObject::tr("Allow %1 to read from and write to the clipboard?");
}
return QString();
@@ -103,8 +103,8 @@ void WebView::setPage(WebPage *page)
&WebView::handleCertificateError);
disconnect(oldPage, &QWebEnginePage::authenticationRequired, this,
&WebView::handleAuthenticationRequired);
- disconnect(oldPage, &QWebEnginePage::featurePermissionRequested, this,
- &WebView::handleFeaturePermissionRequested);
+ disconnect(oldPage, &QWebEnginePage::permissionRequested, this,
+ &WebView::handlePermissionRequested);
disconnect(oldPage, &QWebEnginePage::proxyAuthenticationRequired, this,
&WebView::handleProxyAuthenticationRequired);
disconnect(oldPage, &QWebEnginePage::registerProtocolHandlerRequested, this,
@@ -124,8 +124,8 @@ void WebView::setPage(WebPage *page)
connect(page, &WebPage::createCertificateErrorDialog, this, &WebView::handleCertificateError);
connect(page, &QWebEnginePage::authenticationRequired, this,
&WebView::handleAuthenticationRequired);
- connect(page, &QWebEnginePage::featurePermissionRequested, this,
- &WebView::handleFeaturePermissionRequested);
+ connect(page, &QWebEnginePage::permissionRequested, this,
+ &WebView::handlePermissionRequested);
connect(page, &QWebEnginePage::proxyAuthenticationRequired, this,
&WebView::handleProxyAuthenticationRequired);
connect(page, &QWebEnginePage::registerProtocolHandlerRequested, this,
@@ -309,17 +309,14 @@ void WebView::handleAuthenticationRequired(const QUrl &requestUrl, QAuthenticato
}
}
-void WebView::handleFeaturePermissionRequested(const QUrl &securityOrigin,
- QWebEnginePage::Feature feature)
+void WebView::handlePermissionRequested(QWebEnginePermission permission)
{
QString title = tr("Permission Request");
- QString question = questionForFeature(feature).arg(securityOrigin.host());
+ QString question = questionForFeature(permission.feature()).arg(permission.origin().host());
if (!question.isEmpty() && QMessageBox::question(window(), title, question) == QMessageBox::Yes)
- page()->setFeaturePermission(securityOrigin, feature,
- QWebEnginePage::PermissionGrantedByUser);
+ permission.grant();
else
- page()->setFeaturePermission(securityOrigin, feature,
- QWebEnginePage::PermissionDeniedByUser);
+ permission.deny();
}
void WebView::handleProxyAuthenticationRequired(const QUrl &, QAuthenticator *auth,