Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2076)

Unified Diff: content/public/browser/download_url_parameters.h

Issue 2561903002: [downloads] Set initiator when handling downloads via a[download] (Closed)
Patch Set: Fix compilation Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/browser/download_url_parameters.h
diff --git a/content/public/browser/download_url_parameters.h b/content/public/browser/download_url_parameters.h
index d5c32d8dfb24b4a65f14a5fb60d3c8efa66b1d18..41b0ed637bdbb3dca8662e6c0309594f734e94f7 100644
--- a/content/public/browser/download_url_parameters.h
+++ b/content/public/browser/download_url_parameters.h
@@ -15,12 +15,14 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/optional.h"
#include "content/public/browser/download_interrupt_reasons.h"
#include "content/public/browser/download_save_info.h"
#include "content/public/common/referrer.h"
#include "net/url_request/url_request_context_getter.h"
#include "storage/browser/blob/blob_data_handle.h"
#include "url/gurl.h"
+#include "url/origin.h"
namespace content {
@@ -107,6 +109,12 @@ class CONTENT_EXPORT DownloadUrlParameters {
referrer_encoding_ = referrer_encoding;
}
+ // The origin of the context which initiated the request. See
+ // net::URLRequest::initiator().
+ void set_initiator(const base::Optional<url::Origin>& initiator) {
+ initiator_ = initiator;
+ }
+
// If this is a request for resuming an HTTP/S download, |last_modified|
// should be the value of the last seen Last-Modified response header.
void set_last_modified(const std::string& last_modified) {
@@ -210,6 +218,7 @@ class CONTENT_EXPORT DownloadUrlParameters {
bool prefer_cache() const { return prefer_cache_; }
const Referrer& referrer() const { return referrer_; }
const std::string& referrer_encoding() const { return referrer_encoding_; }
+ const base::Optional<url::Origin>& initiator() const { return initiator_; }
// These will be -1 if the request is not associated with a frame. See
// the constructors for more.
@@ -257,6 +266,7 @@ class CONTENT_EXPORT DownloadUrlParameters {
int64_t post_id_;
bool prefer_cache_;
Referrer referrer_;
+ base::Optional<url::Origin> initiator_;
std::string referrer_encoding_;
int render_process_host_id_;
int render_view_host_routing_id_;

Powered by Google App Engine
This is Rietveld 408576698