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

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

Issue 1829413002: [Downloads] Retain a BlobDataHandle in DownloadUrlParameters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 } 174 }
174 175
175 // If |prompt| is true, then the user will be prompted for a filename. Ignored 176 // If |prompt| is true, then the user will be prompted for a filename. Ignored
176 // if |file_path| is non-empty. 177 // if |file_path| is non-empty.
177 void set_prompt(bool prompt) { save_info_.prompt_for_save_location = prompt; } 178 void set_prompt(bool prompt) { save_info_.prompt_for_save_location = prompt; }
178 void set_file(base::File file) { save_info_.file = std::move(file); } 179 void set_file(base::File file) { save_info_.file = std::move(file); }
179 void set_do_not_prompt_for_login(bool do_not_prompt) { 180 void set_do_not_prompt_for_login(bool do_not_prompt) {
180 do_not_prompt_for_login_ = do_not_prompt; 181 do_not_prompt_for_login_ = do_not_prompt;
181 } 182 }
182 183
184 // For downloads of blob URLs, the caller can store a BlobDataHandle in the
185 // DownloadUrlParameters object so that the blob will remain valid until
186 // the download starts. The BlobDataHandle will be attached to the associated
187 // URLRequest.
188 //
189 // This is optional. If left unspecified, and the blob URL cannot be mapped to
190 // a blob by the time the download request starts, then the download will
191 // fail.
192 void set_blob_data_handle(
193 scoped_ptr<storage::BlobDataHandle> blob_data_handle) {
194 blob_data_handle_ = std::move(blob_data_handle);
195 }
196
183 const OnStartedCallback& callback() const { return callback_; } 197 const OnStartedCallback& callback() const { return callback_; }
184 bool content_initiated() const { return content_initiated_; } 198 bool content_initiated() const { return content_initiated_; }
185 const std::string& last_modified() const { return last_modified_; } 199 const std::string& last_modified() const { return last_modified_; }
186 const std::string& etag() const { return etag_; } 200 const std::string& etag() const { return etag_; }
187 const std::string& method() const { return method_; } 201 const std::string& method() const { return method_; }
188 const std::string& post_body() const { return post_body_; } 202 const std::string& post_body() const { return post_body_; }
189 int64_t post_id() const { return post_id_; } 203 int64_t post_id() const { return post_id_; }
190 bool prefer_cache() const { return prefer_cache_; } 204 bool prefer_cache() const { return prefer_cache_; }
191 const Referrer& referrer() const { return referrer_; } 205 const Referrer& referrer() const { return referrer_; }
192 const std::string& referrer_encoding() const { return referrer_encoding_; } 206 const std::string& referrer_encoding() const { return referrer_encoding_; }
(...skipping 11 matching lines...) Expand all
204 return save_info_.suggested_name; 218 return save_info_.suggested_name;
205 } 219 }
206 int64_t offset() const { return save_info_.offset; } 220 int64_t offset() const { return save_info_.offset; }
207 const std::string& hash_of_partial_file() const { 221 const std::string& hash_of_partial_file() const {
208 return save_info_.hash_of_partial_file; 222 return save_info_.hash_of_partial_file;
209 } 223 }
210 bool prompt() const { return save_info_.prompt_for_save_location; } 224 bool prompt() const { return save_info_.prompt_for_save_location; }
211 const GURL& url() const { return url_; } 225 const GURL& url() const { return url_; }
212 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } 226 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; }
213 227
228 // STATE_CHANGING: Return the BlobDataHandle.
229 scoped_ptr<storage::BlobDataHandle> GetBlobDataHandle() {
230 return std::move(blob_data_handle_);
231 }
232
214 // STATE CHANGING: All save_info_ sub-objects will be in an indeterminate 233 // STATE CHANGING: All save_info_ sub-objects will be in an indeterminate
215 // state following this call. 234 // state following this call.
216 DownloadSaveInfo GetSaveInfo() { return std::move(save_info_); } 235 DownloadSaveInfo GetSaveInfo() { return std::move(save_info_); }
217 236
218 private: 237 private:
219 OnStartedCallback callback_; 238 OnStartedCallback callback_;
220 bool content_initiated_; 239 bool content_initiated_;
221 RequestHeadersType request_headers_; 240 RequestHeadersType request_headers_;
222 std::string last_modified_; 241 std::string last_modified_;
223 std::string etag_; 242 std::string etag_;
224 std::string method_; 243 std::string method_;
225 std::string post_body_; 244 std::string post_body_;
226 int64_t post_id_; 245 int64_t post_id_;
227 bool prefer_cache_; 246 bool prefer_cache_;
228 Referrer referrer_; 247 Referrer referrer_;
229 std::string referrer_encoding_; 248 std::string referrer_encoding_;
230 int render_process_host_id_; 249 int render_process_host_id_;
231 int render_view_host_routing_id_; 250 int render_view_host_routing_id_;
232 int render_frame_host_routing_id_; 251 int render_frame_host_routing_id_;
233 ResourceContext* resource_context_; 252 ResourceContext* resource_context_;
234 DownloadSaveInfo save_info_; 253 DownloadSaveInfo save_info_;
235 GURL url_; 254 GURL url_;
236 bool do_not_prompt_for_login_; 255 bool do_not_prompt_for_login_;
256 scoped_ptr<storage::BlobDataHandle> blob_data_handle_;
237 257
238 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); 258 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters);
239 }; 259 };
240 260
241 } // namespace content 261 } // namespace content
242 262
243 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ 263 #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