summaryrefslogtreecommitdiffstats
path: root/src/core/web_contents_adapter_client.h
diff options
context:
space:
mode:
authorJüri Valdmann <juri.valdmann@qt.io>2017-06-20 10:19:56 +0200
committerJüri Valdmann <juri.valdmann@qt.io>2017-09-12 08:21:40 +0000
commit73ae71cbd1937ef1e2a1ba888a4802792fe6d738 (patch)
tree64162de4723714715e72ba09e646da34a05c46dc /src/core/web_contents_adapter_client.h
parent4fddefdcf2f25c52bd3258ce846233217bf7e465 (diff)
Set referrer on download requests
Note that the Referer header still won't be sent if the download is triggered via an anchor element with the 'download' attribute: crbug.com/455987 . Task-number: QTBUG-61354 Change-Id: I5af971af916b2190756e3e58f19736072a213922 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/core/web_contents_adapter_client.h')
-rw-r--r--src/core/web_contents_adapter_client.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index e1fb3dc4c..3cc5350df 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -71,6 +71,17 @@ class WebContentsAdapter;
class WebContentsDelegateQt;
class WebEngineSettings;
+// Must match blink::WebReferrerPolicy
+enum class ReferrerPolicy {
+ Always,
+ Default,
+ NoReferrerWhenDowngrade,
+ Never,
+ Origin,
+ OriginWhenCrossOrigin,
+ NoReferrerWhenDowngradeOriginWhenCrossOrigin,
+ Last = NoReferrerWhenDowngradeOriginWhenCrossOrigin,
+};
class WebEngineContextMenuSharedData : public QSharedData {
@@ -96,6 +107,9 @@ public:
QString suggestedFileName;
QString misspelledWord;
QStringList spellCheckerSuggestions;
+ QUrl pageUrl;
+ QUrl frameUrl;
+ ReferrerPolicy referrerPolicy = ReferrerPolicy::Default;
// Some likely candidates for future additions as we add support for the related actions:
// bool isImageBlocked;
// <enum tbd> mediaType;
@@ -244,6 +258,34 @@ public:
return d->spellCheckerSuggestions;
}
+ void setFrameUrl(const QUrl &url) {
+ d->frameUrl = url;
+ }
+
+ QUrl frameUrl() const {
+ return d->frameUrl;
+ }
+
+ void setPageUrl(const QUrl &url) {
+ d->pageUrl = url;
+ }
+
+ QUrl pageUrl() const {
+ return d->pageUrl;
+ }
+
+ QUrl referrerUrl() const {
+ return !d->frameUrl.isEmpty() ? d->frameUrl : d->pageUrl;
+ }
+
+ void setReferrerPolicy(ReferrerPolicy referrerPolicy) {
+ d->referrerPolicy = referrerPolicy;
+ }
+
+ ReferrerPolicy referrerPolicy() const {
+ return d->referrerPolicy;
+ }
+
private:
QSharedDataPointer<WebEngineContextMenuSharedData> d;
};