summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2015-03-09 05:30:04 -0700
committerSzabolcs David <davidsz@inf.u-szeged.hu>2015-03-16 11:24:42 +0000
commitd433826c7d0514228b44f0c30ec7e545a3c179bb (patch)
tree2d856a75c50810515187aaaa98c6e834aceffb62
parent29a9caf106e5ea82202b66f6cd45c2db85fb734b (diff)
Move featurePermissionRequested to the public API
Change-Id: Ifc0baac73daad9146eb8f2878e49257d25310555 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
-rw-r--r--src/webengine/api/qquickwebengineview.cpp26
-rw-r--r--src/webengine/api/qquickwebengineview_p.h10
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h13
-rw-r--r--src/webengine/doc/src/qquickwebengineview_lgpl.qdoc31
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp6
-rw-r--r--tests/quicktestbrowser/BrowserWindow.qml11
-rw-r--r--tests/quicktestbrowser/FeaturePermissionBar.qml15
7 files changed, 74 insertions, 38 deletions
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 232d63b3..85d400ca 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -253,7 +253,8 @@ void QQuickWebEngineViewPrivate::allowCertificateError(const QSharedPointer<Cert
void QQuickWebEngineViewPrivate::runGeolocationPermissionRequest(const QUrl &url)
{
- Q_EMIT e->featurePermissionRequested(url, QQuickWebEngineViewExperimental::Geolocation);
+ Q_Q(QQuickWebEngineView);
+ Q_EMIT q->featurePermissionRequested(url, QQuickWebEngineView::Geolocation);
}
void QQuickWebEngineViewPrivate::runFileChooser(FileChooserMode mode, const QString &defaultFileName, const QStringList &acceptedMimeTypes)
@@ -452,16 +453,17 @@ void QQuickWebEngineViewPrivate::javaScriptConsoleMessage(JavaScriptConsoleMessa
void QQuickWebEngineViewPrivate::runMediaAccessPermissionRequest(const QUrl &securityOrigin, WebContentsAdapterClient::MediaRequestFlags requestFlags)
{
- if (!requestFlags)
- return;
- QQuickWebEngineViewExperimental::Feature feature;
- if (requestFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture) && requestFlags.testFlag(WebContentsAdapterClient::MediaVideoCapture))
- feature = QQuickWebEngineViewExperimental::MediaAudioVideoCapture;
- else if (requestFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture))
- feature = QQuickWebEngineViewExperimental::MediaAudioCapture;
- else // WebContentsAdapterClient::MediaVideoCapture
- feature = QQuickWebEngineViewExperimental::MediaVideoCapture;
- Q_EMIT e->featurePermissionRequested(securityOrigin, feature);
+ Q_Q(QQuickWebEngineView);
+ if (!requestFlags)
+ return;
+ QQuickWebEngineView::Feature feature;
+ if (requestFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture) && requestFlags.testFlag(WebContentsAdapterClient::MediaVideoCapture))
+ feature = QQuickWebEngineView::MediaAudioVideoCapture;
+ else if (requestFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture))
+ feature = QQuickWebEngineView::MediaAudioCapture;
+ else // WebContentsAdapterClient::MediaVideoCapture
+ feature = QQuickWebEngineView::MediaVideoCapture;
+ Q_EMIT q->featurePermissionRequested(securityOrigin, feature);
}
void QQuickWebEngineViewPrivate::runMouseLockPermissionRequest(const QUrl &securityOrigin)
@@ -923,7 +925,7 @@ void QQuickWebEngineView::setWebChannel(QQmlWebChannel *webChannel)
Q_EMIT webChannelChanged();
}
-void QQuickWebEngineViewExperimental::grantFeaturePermission(const QUrl &securityOrigin, QQuickWebEngineViewExperimental::Feature feature, bool granted)
+void QQuickWebEngineView::grantFeaturePermission(const QUrl &securityOrigin, QQuickWebEngineView::Feature feature, bool granted)
{
if (!d_ptr->adapter)
return;
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index 248ee62b..c84a6580 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -99,6 +99,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
Q_ENUMS(LoadStatus);
Q_ENUMS(ErrorDomain);
Q_ENUMS(NewViewDestination);
+ Q_ENUMS(Feature);
Q_ENUMS(JavaScriptConsoleMessageLevel);
Q_FLAGS(FindFlags);
@@ -162,6 +163,13 @@ public:
NewViewInBackgroundTab
};
+ enum Feature {
+ MediaAudioCapture,
+ MediaVideoCapture,
+ MediaAudioVideoCapture,
+ Geolocation
+ };
+
// must match WebContentsAdapterClient::JavaScriptConsoleMessageLevel
enum JavaScriptConsoleMessageLevel {
InfoMessageLevel = 0,
@@ -202,6 +210,7 @@ public Q_SLOTS:
void stop();
Q_REVISION(1) void findText(const QString &subString, FindFlags options = 0, const QJSValue &callback = QJSValue());
Q_REVISION(1) void fullScreenCancelled();
+ Q_REVISION(1) void grantFeaturePermission(const QUrl &securityOrigin, Feature, bool granted);
Q_SIGNALS:
void titleChanged();
@@ -215,6 +224,7 @@ Q_SIGNALS:
Q_REVISION(1) void certificateError(QQuickWebEngineCertificateError *error);
Q_REVISION(1) void fullScreenRequested(const QQuickWebEngineFullScreenRequest &request);
Q_REVISION(1) void isFullScreenChanged();
+ Q_REVISION(1) void featurePermissionRequested(const QUrl &securityOrigin, Feature feature);
Q_REVISION(1) void newViewRequested(QQuickWebEngineNewViewRequest *request);
Q_REVISION(1) void zoomFactorChanged(qreal arg);
Q_REVISION(1) void webChannelChanged();
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index ec8f8346..edc8c1a9 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -83,26 +83,13 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineViewExperimental : public QObjec
Q_OBJECT
Q_PROPERTY(QQuickWebEngineViewport *viewport READ viewport)
Q_PROPERTY(QQmlComponent *extraContextMenuEntriesComponent READ extraContextMenuEntriesComponent WRITE setExtraContextMenuEntriesComponent NOTIFY extraContextMenuEntriesComponentChanged)
- Q_ENUMS(Feature)
-
-public:
- enum Feature {
- MediaAudioCapture,
- MediaVideoCapture,
- MediaAudioVideoCapture,
- Geolocation
- };
QQuickWebEngineViewport *viewport() const;
void setExtraContextMenuEntriesComponent(QQmlComponent *);
QQmlComponent *extraContextMenuEntriesComponent() const;
-public Q_SLOTS:
- void grantFeaturePermission(const QUrl &securityOrigin, Feature, bool granted);
-
Q_SIGNALS:
void extraContextMenuEntriesComponentChanged();
- void featurePermissionRequested(const QUrl &securityOrigin, Feature feature);
void loadVisuallyCommitted();
private:
diff --git a/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc b/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc
index 73c084da..035d4a38 100644
--- a/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc
+++ b/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc
@@ -245,6 +245,23 @@
*/
/*!
+ \qmlmethod void WebEngineView::grantFeaturePermission(url securityOrigin, WebEngineView::Feature feature, bool granted)
+
+ Sets the permission for the web site identified by \a securityOrigin to use \a feature.
+
+ \sa featurePermissionRequested()
+*/
+
+/*!
+ \qmlsignal void WebEngineView::featurePermissionRequested(url securityOrigin, WebEngineView::Feature feature)
+
+ This is signal is emitted when the web site identified by \a securityOrigin requests
+ to make use of the resource or device identified by \a feature.
+
+ \sa grantFeaturePermission()
+*/
+
+/*!
\qmlsignal WebEngineView::loadingChanged(loadRequest)
This signal is emitted when a page load begins, ends, or fails.
@@ -416,3 +433,17 @@
\sa WebEngineView::findText()
*/
+
+/*!
+ \qmlproperty enumeration WebEngineView::Feature
+
+ This enum describes the platform feature access categories that the user may be asked to grant or deny access to.
+
+ \value Geolocation Access to location hardware or service
+ \value MediaAudioCapture Audio capture devices such a microphones
+ \value MediaVideoCapture Video devices, e.g. cameras
+ \value MediaAudioVideoCapture Both Audio and Video capture devices.
+
+ \sa featurePermissionRequested(), grantFeaturePermission()
+
+*/
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 1cf2e37c..1ac5a311 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -120,6 +120,10 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.NewViewInTab --> NewViewDestination"
<< "QQuickWebEngineView.NewViewInDialog --> NewViewDestination"
<< "QQuickWebEngineView.NewViewInBackgroundTab --> NewViewDestination"
+ << "QQuickWebEngineView.MediaAudioCapture --> Feature"
+ << "QQuickWebEngineView.MediaVideoCapture --> Feature"
+ << "QQuickWebEngineView.MediaAudioVideoCapture --> Feature"
+ << "QQuickWebEngineView.Geolocation --> Feature"
<< "QQuickWebEngineView.InfoMessageLevel --> JavaScriptConsoleMessageLevel"
<< "QQuickWebEngineView.WarningMessageLevel --> JavaScriptConsoleMessageLevel"
<< "QQuickWebEngineView.ErrorMessageLevel --> JavaScriptConsoleMessageLevel"
@@ -143,6 +147,8 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.fullScreenRequested(QQuickWebEngineFullScreenRequest) --> void"
<< "QQuickWebEngineView.isFullScreenChanged() --> void"
<< "QQuickWebEngineView.fullScreenCancelled() --> void"
+ << "QQuickWebEngineView.featurePermissionRequested(QUrl,Feature) --> void"
+ << "QQuickWebEngineView.grantFeaturePermission(QUrl,Feature,bool) --> void"
<< "QQuickWebEngineView.runJavaScript(QString,QJSValue) --> void"
<< "QQuickWebEngineView.runJavaScript(QString) --> void"
<< "QQuickWebEngineView.loadHtml(QString,QUrl) --> void"
diff --git a/tests/quicktestbrowser/BrowserWindow.qml b/tests/quicktestbrowser/BrowserWindow.qml
index 3f7897f0..45fad8d9 100644
--- a/tests/quicktestbrowser/BrowserWindow.qml
+++ b/tests/quicktestbrowser/BrowserWindow.qml
@@ -397,12 +397,13 @@ ApplicationWindow {
request.accept()
}
+ onFeaturePermissionRequested: {
+ permBar.securityOrigin = securityOrigin;
+ permBar.requestedFeature = feature;
+ permBar.visible = true;
+ }
+
experimental {
- onFeaturePermissionRequested: {
- permBar.securityOrigin = securityOrigin;
- permBar.requestedFeature = feature;
- permBar.visible = true;
- }
extraContextMenuEntriesComponent: ContextMenuExtras {}
}
}
diff --git a/tests/quicktestbrowser/FeaturePermissionBar.qml b/tests/quicktestbrowser/FeaturePermissionBar.qml
index 135df9ab..c9b15dfd 100644
--- a/tests/quicktestbrowser/FeaturePermissionBar.qml
+++ b/tests/quicktestbrowser/FeaturePermissionBar.qml
@@ -40,8 +40,7 @@
import QtQuick 2.1
import QtQuick.Controls 1.0
-import QtWebEngine 1.0
-import QtWebEngine.experimental 1.0
+import QtWebEngine 1.1
import QtQuick.Layouts 1.0
Rectangle {
@@ -69,13 +68,13 @@ Rectangle {
Layout.fillWidth: true
function textForFeature(feature) {
- if (feature === WebEngineViewExperimental.MediaAudioCapture)
+ if (feature === WebEngineView.MediaAudioCapture)
return "your microphone"
- if (feature === WebEngineViewExperimental.MediaVideoCapture)
+ if (feature === WebEngineView.MediaVideoCapture)
return "your camera"
- if (feature === WebEngineViewExperimental.MediaAudioVideoCapture)
+ if (feature === WebEngineView.MediaAudioVideoCapture)
return "your camera and microphone"
- if (feature === WebEngineViewExperimental.Geolocation)
+ if (feature === WebEngineView.Geolocation)
return "your position"
}
}
@@ -85,7 +84,7 @@ Rectangle {
text: "Accept"
Layout.alignment: Qt.AlignRight
onClicked: {
- view.experimental.grantFeaturePermission(securityOrigin, requestedFeature, true);
+ view.grantFeaturePermission(securityOrigin, requestedFeature, true);
permissionBar.visible = false;
}
}
@@ -94,7 +93,7 @@ Rectangle {
text: "Deny"
Layout.alignment: Qt.AlignRight
onClicked: {
- view.experimental.grantFeaturePermission(securityOrigin, requestedFeature, false);
+ view.grantFeaturePermission(securityOrigin, requestedFeature, false);
permissionBar.visible = false
}
}