diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-02-05 14:01:54 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-13 12:50:43 +0100 |
commit | b81a337a63710c4f109dc537f7d4b73acc282596 (patch) | |
tree | 204dbb36ba13ab2e97df3d04f114f0b5dd58d372 /src/webengine/api/qquickwebengineview_p_p.h | |
parent | 185e8a020212756d4e7adfbcd69e16232c8d7dfd (diff) |
QQuickWebEngineView new window API refactoring
Improve the code and API in a few ways:
- Expose a more discoverable "request" argument in the signal.
- Use the request as the carrier of the backend WebContentsAdapter
and get rid of our handle.
- Put the adoption method (renamed to openIn) on the request object
and keep the view API clean of a context-specific adoptHandle method.
- Use an enum instead of strings for the new view destination.
- Do not let JavaScript own the request object since it won't be
necessary until we want to support asynchronous view attachment.
We can create the request object on the heap and let the JavaScript
engine own the object once we want to support it.
- Move the request class to its own header.
- Replace tabs.currentView by currentWebView in the quicknanobrowser
qml code since we now need this property on the root object anyway.
Change-Id: I40d7d15255f516ead9f3e414dd587bf345e6ca4b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/webengine/api/qquickwebengineview_p_p.h')
-rw-r--r-- | src/webengine/api/qquickwebengineview_p_p.h | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index c7fecd477..4e0e8115d 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -55,6 +55,7 @@ class WebContentsAdapter; class UIDelegatesManager; QT_BEGIN_NAMESPACE +class QQuickWebEngineNewViewRequest; class QQuickWebEngineView; class QQmlComponent; class QQmlContext; @@ -77,18 +78,6 @@ private: Q_DECLARE_PRIVATE(QQuickWebEngineView) }; -class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineViewHandle : public QObject { - Q_OBJECT -public: - QQuickWebEngineViewHandle(); - ~QQuickWebEngineViewHandle(); - -private: - QExplicitlySharedDataPointer<WebContentsAdapter> adapter; - friend class QQuickWebEngineViewExperimental; - friend class QQuickWebEngineViewPrivate; -}; - class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineViewExperimental : public QObject { Q_OBJECT Q_PROPERTY(QQuickWebEngineViewport *viewport READ viewport) @@ -101,12 +90,11 @@ public: public Q_SLOTS: QQuickWebEngineViewport *viewport() const; - Q_INVOKABLE void adoptHandle(QQuickWebEngineViewHandle *viewHandle); void setExtraContextMenuEntriesComponent(QQmlComponent *); QQmlComponent *extraContextMenuEntriesComponent() const; Q_SIGNALS: - void createWindow(const QJSValue &newViewHandle, const QString &newViewDisposition); + void newViewRequested(QQuickWebEngineNewViewRequest *request); void fullScreenRequested(bool fullScreen); void isFullScreenChanged(); void extraContextMenuEntriesComponentChanged(); @@ -156,6 +144,7 @@ public: virtual void javaScriptConsoleMessage(int level, const QString& message, int lineNumber, const QString& sourceID) Q_DECL_OVERRIDE; void setDevicePixelRatio(qreal); + void adoptWebContents(WebContentsAdapter *webContents); QExplicitlySharedDataPointer<WebContentsAdapter> adapter; QScopedPointer<QQuickWebEngineViewExperimental> e; |