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

Side by Side Diff: content/public/browser/download_url_parameters.h

Issue 1977623002: Updates to DownloadUrlParameters in preparation for OOPIF changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_
6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ 6 #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // are not created when a resource throttle or a resource handler blocks the 54 // are not created when a resource throttle or a resource handler blocks the
55 // download request. I.e. the download triggered a warning of some sort and 55 // download request. I.e. the download triggered a warning of some sort and
56 // the user chose to not to proceed with the download as a result. 56 // the user chose to not to proceed with the download as a result.
57 typedef base::Callback<void(DownloadItem*, DownloadInterruptReason)> 57 typedef base::Callback<void(DownloadItem*, DownloadInterruptReason)>
58 OnStartedCallback; 58 OnStartedCallback;
59 59
60 typedef std::pair<std::string, std::string> RequestHeadersNameValuePair; 60 typedef std::pair<std::string, std::string> RequestHeadersNameValuePair;
61 typedef std::vector<RequestHeadersNameValuePair> RequestHeadersType; 61 typedef std::vector<RequestHeadersNameValuePair> RequestHeadersType;
62 62
63 // Construct DownloadUrlParameters for downloading the resource at |url| and 63 // Construct DownloadUrlParameters for downloading the resource at |url| and
64 // associating the download with |web_contents|. 64 // associating the download with the main frame of the given WebContents.
65 // 65 static std::unique_ptr<DownloadUrlParameters> CreateForWebContentsMainFrame(
66 // DEPRECATED: Using this method can cause the request to be associated with
67 // the wrong site instance where multiple iframes are involved. Use the
68 // DownloadUrlParameters constructor below and specify the process and frame
69 // IDs explicitly.
70 static std::unique_ptr<DownloadUrlParameters> FromWebContents(
71 WebContents* web_contents, 66 WebContents* web_contents,
72 const GURL& url); 67 const GURL& url);
73 68
74 // Construct DownloadUrlParameters for downloading the resource at |url| and 69 // Constructs a download not associated with a frame.
75 // associating the download with the WebContents identified by
76 // |render_process_host_id| and |render_view_host_routing_id|.
77 // 70 //
78 // If the download is not associated with a WebContents, then set the IDs to 71 // It is not safe to have downloads not associated with a frame and
79 // -1. 72 // this should only be done in a limited set of cases where the download URL
80 // 73 // has been previously vetted. A download that's initiated without
81 // NOTE: Initiating downloads that are not associated with a WebContents is 74 // associating it with a frame don't receive the same security checks
82 // not safe and should only be done in a limited set of cases where the 75 // as a request that's associated with one. Hence, downloads that are not
83 // download URL has been previously vetted. A download that's initiated 76 // associated with a frame should only be made for URLs that are either
84 // without associating it with a WebContents don't receive the same security 77 // trusted or URLs that have previously been successfully issued using a
85 // checks as a request that's associated with one. Hence, downloads that are 78 // non-privileged frame.
86 // not associated with a WebContents should only be made for URLs that are 79 DownloadUrlParameters(
87 // either trusted or URLs that have previously been successfully issued using 80 const GURL& url,
88 // a non-privileged WebContents. 81 net::URLRequestContextGetter* url_request_context_getter);
82
83 // The RenderView routing ID must correspond to the RenderView of the
84 // RenderFrame, both of which share the same RenderProcess. This may be a
85 // different RenderView than the WebContents' main RenderView.
89 DownloadUrlParameters( 86 DownloadUrlParameters(
90 const GURL& url, 87 const GURL& url,
91 int render_process_host_id, 88 int render_process_host_id,
92 int render_view_host_routing_id, 89 int render_view_host_routing_id,
93 int render_frame_host_routing_id, 90 int render_frame_host_routing_id,
94 net::URLRequestContextGetter* url_request_context_getter); 91 net::URLRequestContextGetter* url_request_context_getter);
95 92
96 ~DownloadUrlParameters(); 93 ~DownloadUrlParameters();
97 94
98 // Should be set to true if the download was initiated by a script or a web 95 // Should be set to true if the download was initiated by a script or a web
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 const OnStartedCallback& callback() const { return callback_; } 204 const OnStartedCallback& callback() const { return callback_; }
208 bool content_initiated() const { return content_initiated_; } 205 bool content_initiated() const { return content_initiated_; }
209 const std::string& last_modified() const { return last_modified_; } 206 const std::string& last_modified() const { return last_modified_; }
210 const std::string& etag() const { return etag_; } 207 const std::string& etag() const { return etag_; }
211 const std::string& method() const { return method_; } 208 const std::string& method() const { return method_; }
212 const std::string& post_body() const { return post_body_; } 209 const std::string& post_body() const { return post_body_; }
213 int64_t post_id() const { return post_id_; } 210 int64_t post_id() const { return post_id_; }
214 bool prefer_cache() const { return prefer_cache_; } 211 bool prefer_cache() const { return prefer_cache_; }
215 const Referrer& referrer() const { return referrer_; } 212 const Referrer& referrer() const { return referrer_; }
216 const std::string& referrer_encoding() const { return referrer_encoding_; } 213 const std::string& referrer_encoding() const { return referrer_encoding_; }
214
215 // These will be -1 if the request is not associated with a frame. See
216 // the constructors for more.
217 int render_process_host_id() const { return render_process_host_id_; } 217 int render_process_host_id() const { return render_process_host_id_; }
218 int render_view_host_routing_id() const { 218 int render_view_host_routing_id() const {
219 return render_view_host_routing_id_; 219 return render_view_host_routing_id_;
220 } 220 }
221 int render_frame_host_routing_id() const { 221 int render_frame_host_routing_id() const {
222 return render_frame_host_routing_id_; 222 return render_frame_host_routing_id_;
223 } 223 }
224
224 const RequestHeadersType& request_headers() const { return request_headers_; } 225 const RequestHeadersType& request_headers() const { return request_headers_; }
225 net::URLRequestContextGetter* url_request_context_getter() { 226 net::URLRequestContextGetter* url_request_context_getter() {
226 return url_request_context_getter_.get(); 227 return url_request_context_getter_.get();
227 } 228 }
228 const base::FilePath& file_path() const { return save_info_.file_path; } 229 const base::FilePath& file_path() const { return save_info_.file_path; }
229 const base::string16& suggested_name() const { 230 const base::string16& suggested_name() const {
230 return save_info_.suggested_name; 231 return save_info_.suggested_name;
231 } 232 }
232 int64_t offset() const { return save_info_.offset; } 233 int64_t offset() const { return save_info_.offset; }
233 const std::string& hash_of_partial_file() const { 234 const std::string& hash_of_partial_file() const {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 GURL url_; 267 GURL url_;
267 bool do_not_prompt_for_login_; 268 bool do_not_prompt_for_login_;
268 std::unique_ptr<storage::BlobDataHandle> blob_data_handle_; 269 std::unique_ptr<storage::BlobDataHandle> blob_data_handle_;
269 270
270 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); 271 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters);
271 }; 272 };
272 273
273 } // namespace content 274 } // namespace content
274 275
275 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ 276 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/browser/download_url_parameters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698