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

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

Issue 1924473003: [Downloads] Use the initiating StoragePartition for resumption. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo in comment Created 4 years, 7 months 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
« no previous file with comments | « content/public/browser/download_manager.h ('k') | content/public/browser/download_url_parameters.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d800ac41870a19ccaf7ee8e269fbd9a4dee80e9d..7a580a3f9c7268f7a8e1a29d22d5e1cca2f57ef7 100644
--- a/content/public/browser/download_url_parameters.h
+++ b/content/public/browser/download_url_parameters.h
@@ -14,16 +14,17 @@
#include "base/callback.h"
#include "base/macros.h"
+#include "base/memory/ref_counted.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"
namespace content {
class DownloadItem;
-class ResourceContext;
class ResourceDispatcherHost;
class WebContents;
@@ -61,6 +62,11 @@ class CONTENT_EXPORT DownloadUrlParameters {
// Construct DownloadUrlParameters for downloading the resource at |url| and
// associating the download with |web_contents|.
+ //
+ // DEPRECATED: Using this method can cause the request to be associated with
+ // the wrong site instance where multiple iframes are involved. Use the
+ // DownloadUrlParameters constructor below and specify the process and frame
+ // IDs explicitly.
static std::unique_ptr<DownloadUrlParameters> FromWebContents(
WebContents* web_contents,
const GURL& url);
@@ -71,18 +77,21 @@ class CONTENT_EXPORT DownloadUrlParameters {
//
// If the download is not associated with a WebContents, then set the IDs to
// -1.
- // NOTE: This is not safe and should only be done in a limited set of cases
- // where the download URL has been previously vetted. A download that's
- // initiated without associating it with a WebContents don't receive the same
- // security checks as a request that's associated with one. Hence, downloads
- // that are not associated with a WebContents should only be made for URLs
- // that are either trusted or URLs that have previously been successfully
- // issued using a non-privileged WebContents.
- DownloadUrlParameters(const GURL& url,
- int render_process_host_id,
- int render_view_host_routing_id,
- int render_frame_host_routing_id,
- ResourceContext* resource_context);
+ //
+ // NOTE: Initiating downloads that are not associated with a WebContents is
+ // not safe and should only be done in a limited set of cases where the
+ // download URL has been previously vetted. A download that's initiated
+ // without associating it with a WebContents don't receive the same security
+ // checks as a request that's associated with one. Hence, downloads that are
+ // not associated with a WebContents should only be made for URLs that are
+ // either trusted or URLs that have previously been successfully issued using
+ // a non-privileged WebContents.
+ DownloadUrlParameters(
+ const GURL& url,
+ int render_process_host_id,
+ int render_view_host_routing_id,
+ int render_frame_host_routing_id,
+ net::URLRequestContextGetter* url_request_context_getter);
~DownloadUrlParameters();
@@ -213,7 +222,9 @@ class CONTENT_EXPORT DownloadUrlParameters {
return render_frame_host_routing_id_;
}
const RequestHeadersType& request_headers() const { return request_headers_; }
- ResourceContext* resource_context() const { return resource_context_; }
+ net::URLRequestContextGetter* url_request_context_getter() {
+ return url_request_context_getter_.get();
+ }
const base::FilePath& file_path() const { return save_info_.file_path; }
const base::string16& suggested_name() const {
return save_info_.suggested_name;
@@ -250,7 +261,7 @@ class CONTENT_EXPORT DownloadUrlParameters {
int render_process_host_id_;
int render_view_host_routing_id_;
int render_frame_host_routing_id_;
- ResourceContext* resource_context_;
+ scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
DownloadSaveInfo save_info_;
GURL url_;
bool do_not_prompt_for_login_;
« no previous file with comments | « content/public/browser/download_manager.h ('k') | content/public/browser/download_url_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698