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

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

Issue 1835913002: [Merge M50] [Downloads] Retain a BlobDataHandle in DownloadUrlParameters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 8 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 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "content/public/browser/download_interrupt_reasons.h" 16 #include "content/public/browser/download_interrupt_reasons.h"
17 #include "content/public/browser/download_save_info.h" 17 #include "content/public/browser/download_save_info.h"
18 #include "content/public/common/referrer.h" 18 #include "content/public/common/referrer.h"
19 #include "storage/browser/blob/blob_data_handle.h"
19 #include "url/gurl.h" 20 #include "url/gurl.h"
20 21
21 namespace content { 22 namespace content {
22 23
23 class DownloadItem; 24 class DownloadItem;
24 class ResourceContext; 25 class ResourceContext;
25 class ResourceDispatcherHost; 26 class ResourceDispatcherHost;
26 class WebContents; 27 class WebContents;
27 28
28 // Pass an instance of DownloadUrlParameters to DownloadManager::DownloadUrl() 29 // Pass an instance of DownloadUrlParameters to DownloadManager::DownloadUrl()
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 161 }
161 162
162 // If |prompt| is true, then the user will be prompted for a filename. Ignored 163 // If |prompt| is true, then the user will be prompted for a filename. Ignored
163 // if |file_path| is non-empty. 164 // if |file_path| is non-empty.
164 void set_prompt(bool prompt) { save_info_.prompt_for_save_location = prompt; } 165 void set_prompt(bool prompt) { save_info_.prompt_for_save_location = prompt; }
165 void set_file(base::File file) { save_info_.file = std::move(file); } 166 void set_file(base::File file) { save_info_.file = std::move(file); }
166 void set_do_not_prompt_for_login(bool do_not_prompt) { 167 void set_do_not_prompt_for_login(bool do_not_prompt) {
167 do_not_prompt_for_login_ = do_not_prompt; 168 do_not_prompt_for_login_ = do_not_prompt;
168 } 169 }
169 170
171 // For downloads of blob URLs, the caller can store a BlobDataHandle in the
172 // DownloadUrlParameters object so that the blob will remain valid until
173 // the download starts. The BlobDataHandle will be attached to the associated
174 // URLRequest.
175 //
176 // This is optional. If left unspecified, and the blob URL cannot be mapped to
177 // a blob by the time the download request starts, then the download will
178 // fail.
179 void set_blob_data_handle(
180 scoped_ptr<storage::BlobDataHandle> blob_data_handle) {
181 blob_data_handle_ = std::move(blob_data_handle);
182 }
183
170 const OnStartedCallback& callback() const { return callback_; } 184 const OnStartedCallback& callback() const { return callback_; }
171 bool content_initiated() const { return content_initiated_; } 185 bool content_initiated() const { return content_initiated_; }
172 const std::string& last_modified() const { return last_modified_; } 186 const std::string& last_modified() const { return last_modified_; }
173 const std::string& etag() const { return etag_; } 187 const std::string& etag() const { return etag_; }
174 const std::string& method() const { return method_; } 188 const std::string& method() const { return method_; }
175 const std::string& post_body() const { return post_body_; } 189 const std::string& post_body() const { return post_body_; }
176 int64_t post_id() const { return post_id_; } 190 int64_t post_id() const { return post_id_; }
177 bool prefer_cache() const { return prefer_cache_; } 191 bool prefer_cache() const { return prefer_cache_; }
178 const Referrer& referrer() const { return referrer_; } 192 const Referrer& referrer() const { return referrer_; }
179 const std::string& referrer_encoding() const { return referrer_encoding_; } 193 const std::string& referrer_encoding() const { return referrer_encoding_; }
180 int render_process_host_id() const { return render_process_host_id_; } 194 int render_process_host_id() const { return render_process_host_id_; }
181 int render_view_host_routing_id() const { 195 int render_view_host_routing_id() const {
182 return render_view_host_routing_id_; 196 return render_view_host_routing_id_;
183 } 197 }
184 int render_frame_host_routing_id() const { 198 int render_frame_host_routing_id() const {
185 return render_frame_host_routing_id_; 199 return render_frame_host_routing_id_;
186 } 200 }
187 const RequestHeadersType& request_headers() const { return request_headers_; } 201 const RequestHeadersType& request_headers() const { return request_headers_; }
188 ResourceContext* resource_context() const { return resource_context_; } 202 ResourceContext* resource_context() const { return resource_context_; }
189 const base::FilePath& file_path() const { return save_info_.file_path; } 203 const base::FilePath& file_path() const { return save_info_.file_path; }
190 const base::string16& suggested_name() const { 204 const base::string16& suggested_name() const {
191 return save_info_.suggested_name; 205 return save_info_.suggested_name;
192 } 206 }
193 int64_t offset() const { return save_info_.offset; } 207 int64_t offset() const { return save_info_.offset; }
194 const std::string& hash_state() const { return save_info_.hash_state; } 208 const std::string& hash_state() const { return save_info_.hash_state; }
195 bool prompt() const { return save_info_.prompt_for_save_location; } 209 bool prompt() const { return save_info_.prompt_for_save_location; }
196 const GURL& url() const { return url_; } 210 const GURL& url() const { return url_; }
197 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } 211 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; }
198 212
213 // STATE_CHANGING: Return the BlobDataHandle.
214 scoped_ptr<storage::BlobDataHandle> GetBlobDataHandle() {
215 return std::move(blob_data_handle_);
216 }
217
199 // Note that this is state changing--the DownloadUrlParameters object 218 // Note that this is state changing--the DownloadUrlParameters object
200 // will not have a file attached to it after this call. 219 // will not have a file attached to it after this call.
201 base::File GetFile() { return std::move(save_info_.file); } 220 base::File GetFile() { return std::move(save_info_.file); }
202 221
203 private: 222 private:
204 OnStartedCallback callback_; 223 OnStartedCallback callback_;
205 bool content_initiated_; 224 bool content_initiated_;
206 RequestHeadersType request_headers_; 225 RequestHeadersType request_headers_;
207 std::string last_modified_; 226 std::string last_modified_;
208 std::string etag_; 227 std::string etag_;
209 std::string method_; 228 std::string method_;
210 std::string post_body_; 229 std::string post_body_;
211 int64_t post_id_; 230 int64_t post_id_;
212 bool prefer_cache_; 231 bool prefer_cache_;
213 Referrer referrer_; 232 Referrer referrer_;
214 std::string referrer_encoding_; 233 std::string referrer_encoding_;
215 int render_process_host_id_; 234 int render_process_host_id_;
216 int render_view_host_routing_id_; 235 int render_view_host_routing_id_;
217 int render_frame_host_routing_id_; 236 int render_frame_host_routing_id_;
218 ResourceContext* resource_context_; 237 ResourceContext* resource_context_;
219 DownloadSaveInfo save_info_; 238 DownloadSaveInfo save_info_;
220 GURL url_; 239 GURL url_;
221 bool do_not_prompt_for_login_; 240 bool do_not_prompt_for_login_;
241 scoped_ptr<storage::BlobDataHandle> blob_data_handle_;
222 242
223 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); 243 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters);
224 }; 244 };
225 245
226 } // namespace content 246 } // namespace content
227 247
228 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ 248 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | content/test/data/download/download-attribute-blob.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698