diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/api/qwebenginenavigationrequest.cpp | 27 | ||||
-rw-r--r-- | src/core/api/qwebenginenavigationrequest.h | 4 | ||||
-rw-r--r-- | src/core/api/qwebenginepage.cpp | 4 | ||||
-rw-r--r-- | src/core/api/qwebenginepage_p.h | 2 | ||||
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 3 | ||||
-rw-r--r-- | src/core/web_contents_adapter_client.h | 2 | ||||
-rw-r--r-- | src/core/web_contents_delegate_qt.cpp | 2 | ||||
-rw-r--r-- | src/webenginequick/api/qquickwebengineview.cpp | 4 | ||||
-rw-r--r-- | src/webenginequick/api/qquickwebengineview_p_p.h | 2 |
9 files changed, 37 insertions, 13 deletions
diff --git a/src/core/api/qwebenginenavigationrequest.cpp b/src/core/api/qwebenginenavigationrequest.cpp index 0a30f6472..dc7447b88 100644 --- a/src/core/api/qwebenginenavigationrequest.cpp +++ b/src/core/api/qwebenginenavigationrequest.cpp @@ -9,15 +9,17 @@ QT_BEGIN_NAMESPACE class QWebEngineNavigationRequestPrivate { public: - QWebEngineNavigationRequestPrivate(const QUrl& url, QWebEngineNavigationRequest::NavigationType navigationType, bool mainFrame) + QWebEngineNavigationRequestPrivate(const QUrl& url, QWebEngineNavigationRequest::NavigationType navigationType, bool mainFrame, bool formData) : url(url) , navigationType(navigationType) , isMainFrame(mainFrame) + , hasFormData(formData) {} QUrl url; QWebEngineNavigationRequest::NavigationType navigationType; bool isMainFrame; + bool hasFormData; bool isAccepted = true; }; @@ -51,9 +53,9 @@ public: /*! \internal */ -QWebEngineNavigationRequest::QWebEngineNavigationRequest(const QUrl& url, QWebEngineNavigationRequest::NavigationType navigationType, bool mainFrame, QObject* parent) +QWebEngineNavigationRequest::QWebEngineNavigationRequest(const QUrl& url, QWebEngineNavigationRequest::NavigationType navigationType, bool mainFrame, bool formData, QObject* parent) : QObject(parent) - , d_ptr(new QWebEngineNavigationRequestPrivate(url, navigationType, mainFrame)) + , d_ptr(new QWebEngineNavigationRequestPrivate(url, navigationType, mainFrame, formData)) { } @@ -174,6 +176,25 @@ bool QWebEngineNavigationRequest::isMainFrame() const return d->isMainFrame; } +/*! + \property QWebEngineNavigationRequest::hasFormData + \brief Whether the navigation request contains form data + \since 6.8 +*/ +/*! + \qmlproperty bool WebEngineNavigationRequest::hasFormData + \since 6.8 + \readonly + + Whether the navigation request contains form data +*/ + +bool QWebEngineNavigationRequest::hasFormData() const +{ + Q_D(const QWebEngineNavigationRequest); + return d->hasFormData; +} + /*! \internal */ bool QWebEngineNavigationRequest::isAccepted() const { diff --git a/src/core/api/qwebenginenavigationrequest.h b/src/core/api/qwebenginenavigationrequest.h index 12fc2b4a1..a810a59fe 100644 --- a/src/core/api/qwebenginenavigationrequest.h +++ b/src/core/api/qwebenginenavigationrequest.h @@ -17,6 +17,7 @@ class Q_WEBENGINECORE_EXPORT QWebEngineNavigationRequest : public QObject Q_OBJECT Q_PROPERTY(QUrl url READ url CONSTANT FINAL) Q_PROPERTY(bool isMainFrame READ isMainFrame CONSTANT FINAL) + Q_PROPERTY(bool hasFormData READ hasFormData CONSTANT REVISION(6, 8) FINAL) Q_PROPERTY(NavigationType navigationType READ navigationType CONSTANT FINAL) public: @@ -36,6 +37,7 @@ public: QUrl url() const; bool isMainFrame() const; + bool hasFormData() const; NavigationType navigationType() const; Q_INVOKABLE void accept(); @@ -60,7 +62,7 @@ Q_SIGNALS: #endif private: - QWebEngineNavigationRequest(const QUrl &url, NavigationType navigationType, bool mainFrame, + QWebEngineNavigationRequest(const QUrl &url, NavigationType navigationType, bool mainFrame, bool formData, QObject *parent = nullptr); friend class QWebEnginePagePrivate; diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp index ac645c430..686cee391 100644 --- a/src/core/api/qwebenginepage.cpp +++ b/src/core/api/qwebenginepage.cpp @@ -1516,13 +1516,13 @@ void QWebEnginePagePrivate::contextMenuRequested(QWebEngineContextMenuRequest *d \sa acceptNavigationRequest() */ -void QWebEnginePagePrivate::navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame) +void QWebEnginePagePrivate::navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame, bool hasFormData) { Q_Q(QWebEnginePage); accepted = q->acceptNavigationRequest(url, static_cast<QWebEnginePage::NavigationType>(navigationType), isMainFrame); if (accepted) { - QWebEngineNavigationRequest navigationRequest(url, static_cast<QWebEngineNavigationRequest::NavigationType>(navigationType), isMainFrame); + QWebEngineNavigationRequest navigationRequest(url, static_cast<QWebEngineNavigationRequest::NavigationType>(navigationType), isMainFrame, hasFormData); Q_EMIT q->navigationRequested(navigationRequest); accepted = navigationRequest.isAccepted(); } diff --git a/src/core/api/qwebenginepage_p.h b/src/core/api/qwebenginepage_p.h index a51d8603b..31ace7e9d 100644 --- a/src/core/api/qwebenginepage_p.h +++ b/src/core/api/qwebenginepage_p.h @@ -124,7 +124,7 @@ public: void windowCloseRejected() override; void desktopMediaRequested(QtWebEngineCore::DesktopMediaController *) override; void contextMenuRequested(QWebEngineContextMenuRequest *request) override; - void navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame) override; + void navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame, bool hasFormData) override; void requestFullScreenMode(const QUrl &origin, bool fullscreen) override; bool isFullScreenMode() const override; void javascriptDialog(QSharedPointer<QtWebEngineCore::JavaScriptDialogController>) override; diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 53c2caa2d..7192edbc2 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -827,7 +827,8 @@ static bool navigationThrottleCallback(content::NavigationHandle *handle) client->navigationRequested(pageTransitionToNavigationType(transition_type), toQt(handle->GetURL()), navigationAccepted, - handle->IsInPrimaryMainFrame()); + handle->IsInPrimaryMainFrame(), + handle->IsFormSubmission()); return !navigationAccepted; } diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index 1a1474644..a1ad301ed 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -169,7 +169,7 @@ public: virtual void windowCloseRejected() = 0; virtual void contextMenuRequested(QWebEngineContextMenuRequest *request) = 0; virtual void desktopMediaRequested(DesktopMediaController *) = 0; - virtual void navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame) = 0; + virtual void navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame, bool hasFormData) = 0; virtual void requestFullScreenMode(const QUrl &origin, bool fullscreen) = 0; virtual bool isFullScreenMode() const = 0; virtual void javascriptDialog(QSharedPointer<JavaScriptDialogController>) = 0; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 194274fcb..4df73fb69 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -760,7 +760,7 @@ void WebContentsDelegateQt::launchExternalURL(const QUrl &url, ui::PageTransitio } if (navigationAllowedByPolicy) { - m_viewClient->navigationRequested(pageTransitionToNavigationType(page_transition), url, navigationRequestAccepted, is_main_frame); + m_viewClient->navigationRequested(pageTransitionToNavigationType(page_transition), url, navigationRequestAccepted, is_main_frame, false); #if QT_CONFIG(desktopservices) if (navigationRequestAccepted) QDesktopServices::openUrl(url); diff --git a/src/webenginequick/api/qquickwebengineview.cpp b/src/webenginequick/api/qquickwebengineview.cpp index 78248346b..89cdd20ca 100644 --- a/src/webenginequick/api/qquickwebengineview.cpp +++ b/src/webenginequick/api/qquickwebengineview.cpp @@ -446,10 +446,10 @@ void QQuickWebEngineViewPrivate::contextMenuRequested(QWebEngineContextMenuReque ui()->showMenu(menu); } -void QQuickWebEngineViewPrivate::navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame) +void QQuickWebEngineViewPrivate::navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame, bool hasFrameData) { Q_Q(QQuickWebEngineView); - auto request = new QWebEngineNavigationRequest(url, static_cast<QWebEngineNavigationRequest::NavigationType>(navigationType), isMainFrame); + auto request = new QWebEngineNavigationRequest(url, static_cast<QWebEngineNavigationRequest::NavigationType>(navigationType), isMainFrame, hasFrameData); qmlEngine(q)->newQObject(request); Q_EMIT q->navigationRequested(request); diff --git a/src/webenginequick/api/qquickwebengineview_p_p.h b/src/webenginequick/api/qquickwebengineview_p_p.h index 66e53bdd0..58236bc58 100644 --- a/src/webenginequick/api/qquickwebengineview_p_p.h +++ b/src/webenginequick/api/qquickwebengineview_p_p.h @@ -88,7 +88,7 @@ public: void requestFullScreenMode(const QUrl &origin, bool fullscreen) override; bool isFullScreenMode() const override; void contextMenuRequested(QWebEngineContextMenuRequest *request) override; - void navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame) override; + void navigationRequested(int navigationType, const QUrl &url, bool &accepted, bool isMainFrame, bool hasFrameData) override; void javascriptDialog(QSharedPointer<QtWebEngineCore::JavaScriptDialogController>) override; void runFileChooser(QSharedPointer<QtWebEngineCore::FilePickerController>) override; void desktopMediaRequested(QtWebEngineCore::DesktopMediaController *) override; |