diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-10-17 11:23:26 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-10-21 08:13:41 +0000 |
commit | 2708f4fe1f1a4aca14d888303bbdc21bcf629a19 (patch) | |
tree | fe0622b16daa66b82132bc6b1930934fee879dfa /chromium/components/download/public/common/download_item_impl.h | |
parent | 2a45953d844a6d1be6df8aeb7359a98daaa52ee2 (diff) | |
download | qtwebengine-chromium-2708f4fe1f1a4aca14d888303bbdc21bcf629a19.tar.gz |
[Backport] Plumb initiating origin info to download stack.
This CL passes along the initiating origin of a request down into
DownloadInfo and related objects. The current download objects store
substantial context related to where a download comes from, but not
enough to reliably determine requesting origin. This functionality
will be used in a subsequent CL to block some forms downloads as
mixed content.
Bug: 960819
Change-Id: Ifa2537141bb71c37665608e992ee91cd665c41ea
Reviewed-by: Min Qin <qinmin@chromium.org>
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Xi Han <hanxi@chromium.org>
Reviewed-by: Christopher Thompson <cthomp@chromium.org>
Commit-Queue: Joe DeBlasio <jdeblasio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658571}
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
Diffstat (limited to 'chromium/components/download/public/common/download_item_impl.h')
-rw-r--r-- | chromium/components/download/public/common/download_item_impl.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/chromium/components/download/public/common/download_item_impl.h b/chromium/components/download/public/common/download_item_impl.h index 4ede432f44f..c704ecc629c 100644 --- a/chromium/components/download/public/common/download_item_impl.h +++ b/chromium/components/download/public/common/download_item_impl.h @@ -16,6 +16,7 @@ #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" +#include "base/optional.h" #include "base/threading/thread_checker_impl.h" #include "base/time/time.h" #include "components/download/public/common/download_create_info.h" @@ -27,6 +28,7 @@ #include "components/download/public/common/download_url_parameters.h" #include "components/download/public/common/resume_mode.h" #include "url/gurl.h" +#include "url/origin.h" namespace net { class URLRequestContextGetter; @@ -53,6 +55,7 @@ class COMPONENTS_DOWNLOAD_EXPORT DownloadItemImpl const GURL& site_url, const GURL& tab_url, const GURL& tab_referrer_url, + const base::Optional<url::Origin>& request_initiator, const std::string& suggested_filename, const base::FilePath& forced_file_path, ui::PageTransition transition_type, @@ -79,6 +82,9 @@ class COMPONENTS_DOWNLOAD_EXPORT DownloadItemImpl // The URL of the referrer of the tab that initiated the download. GURL tab_referrer_url; + // The origin of the requester that originally initiated the download. + base::Optional<url::Origin> request_initiator; + // Filename suggestion from DownloadSaveInfo. It could, among others, be the // suggested filename in 'download' attribute of an anchor. Details: // http://www.whatwg.org/specs/web-apps/current-work/#downloading-hyperlinks @@ -169,6 +175,7 @@ class COMPONENTS_DOWNLOAD_EXPORT DownloadItemImpl const GURL& site_url, const GURL& tab_url, const GURL& tab_referrer_url, + const base::Optional<url::Origin>& request_initiator, const std::string& mime_type, const std::string& original_mime_type, base::Time start_time, @@ -238,6 +245,7 @@ class COMPONENTS_DOWNLOAD_EXPORT DownloadItemImpl const GURL& GetSiteUrl() const override; const GURL& GetTabUrl() const override; const GURL& GetTabReferrerUrl() const override; + const base::Optional<url::Origin>& GetRequestInitiator() const override; std::string GetSuggestedFilename() const override; const scoped_refptr<const net::HttpResponseHeaders>& GetResponseHeaders() const override; |