diff options
author | Yigit Akcay <yigit.akcay@qt.io> | 2023-02-15 20:43:25 +0100 |
---|---|---|
committer | Yigit Akcay <yigit.akcay@qt.io> | 2023-03-10 17:13:32 +0100 |
commit | 5e257fb57a211f95556ec387fe6f262a60cbb6fe (patch) | |
tree | 330abbb7f84f8664fbd44b80d573265da4cc2bcb /src/core/web_contents_adapter.cpp | |
parent | 28a2cfe4116f7218b33df811b79536c0593ddda6 (diff) |
QWebEngineUrlResponseInterceptor: Implement new URL response interceptor
This patch adds the QWebEngineUrlResponseInterceptor abstract class,
which, when implemented, allows a user to intercept response headers and
modify them in any way they like.
A response interceptor can be set via
QWebEngineProfile::setUrlResponseInterceptor(),
QQuickWebEngineProfile::setUrlResponseInterceptor() or
QWebEnginePage::setUrlResponseInterceptor().
Also, the QWebEngineUrlResponseInfo class is implemented, which contains
the request and response data to be used with the response interceptor.
If a response interceptor is set in the profile and page, the one in the
profile takes precedence.
Fixes: QTBUG-61071
Change-Id: I484d14373ff597b1d531541c066f0102bae28c72
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r-- | src/core/web_contents_adapter.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 5b880d31a..997019b03 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -1013,6 +1013,16 @@ QWebEngineUrlRequestInterceptor* WebContentsAdapter::requestInterceptor() const return m_requestInterceptor; } +void WebContentsAdapter::setResponseInterceptor(QWebEngineUrlResponseInterceptor *interceptor) +{ + m_responseInterceptor = interceptor; +} + +QWebEngineUrlResponseInterceptor *WebContentsAdapter::responseInterceptor() const +{ + return m_responseInterceptor; +} + #if QT_CONFIG(accessibility) QAccessibleInterface *WebContentsAdapter::browserAccessible() { |