OLD | NEW |
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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 } | 198 } |
199 | 199 |
200 // If |prompt| is true, then the user will be prompted for a filename. Ignored | 200 // If |prompt| is true, then the user will be prompted for a filename. Ignored |
201 // if |file_path| is non-empty. | 201 // if |file_path| is non-empty. |
202 void set_prompt(bool prompt) { save_info_.prompt_for_save_location = prompt; } | 202 void set_prompt(bool prompt) { save_info_.prompt_for_save_location = prompt; } |
203 void set_file(base::File file) { save_info_.file = std::move(file); } | 203 void set_file(base::File file) { save_info_.file = std::move(file); } |
204 void set_do_not_prompt_for_login(bool do_not_prompt) { | 204 void set_do_not_prompt_for_login(bool do_not_prompt) { |
205 do_not_prompt_for_login_ = do_not_prompt; | 205 do_not_prompt_for_login_ = do_not_prompt; |
206 } | 206 } |
207 | 207 |
| 208 // Sets whether the download is to be treated as transient. A transient |
| 209 // download is short-lived and is not shown in the UI. |
| 210 void set_transient(bool transient) { transient_ = transient; } |
| 211 |
208 // For downloads of blob URLs, the caller can store a BlobDataHandle in the | 212 // For downloads of blob URLs, the caller can store a BlobDataHandle in the |
209 // DownloadUrlParameters object so that the blob will remain valid until | 213 // DownloadUrlParameters object so that the blob will remain valid until |
210 // the download starts. The BlobDataHandle will be attached to the associated | 214 // the download starts. The BlobDataHandle will be attached to the associated |
211 // URLRequest. | 215 // URLRequest. |
212 // | 216 // |
213 // This is optional. If left unspecified, and the blob URL cannot be mapped to | 217 // This is optional. If left unspecified, and the blob URL cannot be mapped to |
214 // a blob by the time the download request starts, then the download will | 218 // a blob by the time the download request starts, then the download will |
215 // fail. | 219 // fail. |
216 void set_blob_data_handle( | 220 void set_blob_data_handle( |
217 std::unique_ptr<storage::BlobDataHandle> blob_data_handle) { | 221 std::unique_ptr<storage::BlobDataHandle> blob_data_handle) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 return save_info_.suggested_name; | 254 return save_info_.suggested_name; |
251 } | 255 } |
252 int64_t offset() const { return save_info_.offset; } | 256 int64_t offset() const { return save_info_.offset; } |
253 int64_t length() const { return save_info_.length; } | 257 int64_t length() const { return save_info_.length; } |
254 const std::string& hash_of_partial_file() const { | 258 const std::string& hash_of_partial_file() const { |
255 return save_info_.hash_of_partial_file; | 259 return save_info_.hash_of_partial_file; |
256 } | 260 } |
257 bool prompt() const { return save_info_.prompt_for_save_location; } | 261 bool prompt() const { return save_info_.prompt_for_save_location; } |
258 const GURL& url() const { return url_; } | 262 const GURL& url() const { return url_; } |
259 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } | 263 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } |
| 264 bool is_transient() const { return transient_; } |
260 | 265 |
261 // STATE_CHANGING: Return the BlobDataHandle. | 266 // STATE_CHANGING: Return the BlobDataHandle. |
262 std::unique_ptr<storage::BlobDataHandle> GetBlobDataHandle() { | 267 std::unique_ptr<storage::BlobDataHandle> GetBlobDataHandle() { |
263 return std::move(blob_data_handle_); | 268 return std::move(blob_data_handle_); |
264 } | 269 } |
265 | 270 |
266 // STATE CHANGING: All save_info_ sub-objects will be in an indeterminate | 271 // STATE CHANGING: All save_info_ sub-objects will be in an indeterminate |
267 // state following this call. | 272 // state following this call. |
268 DownloadSaveInfo GetSaveInfo() { return std::move(save_info_); } | 273 DownloadSaveInfo GetSaveInfo() { return std::move(save_info_); } |
269 | 274 |
(...skipping 11 matching lines...) Expand all Loading... |
281 Referrer referrer_; | 286 Referrer referrer_; |
282 base::Optional<url::Origin> initiator_; | 287 base::Optional<url::Origin> initiator_; |
283 std::string referrer_encoding_; | 288 std::string referrer_encoding_; |
284 int render_process_host_id_; | 289 int render_process_host_id_; |
285 int render_view_host_routing_id_; | 290 int render_view_host_routing_id_; |
286 int render_frame_host_routing_id_; | 291 int render_frame_host_routing_id_; |
287 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 292 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
288 DownloadSaveInfo save_info_; | 293 DownloadSaveInfo save_info_; |
289 GURL url_; | 294 GURL url_; |
290 bool do_not_prompt_for_login_; | 295 bool do_not_prompt_for_login_; |
| 296 bool transient_; |
291 std::unique_ptr<storage::BlobDataHandle> blob_data_handle_; | 297 std::unique_ptr<storage::BlobDataHandle> blob_data_handle_; |
292 | 298 |
293 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); | 299 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); |
294 }; | 300 }; |
295 | 301 |
296 } // namespace content | 302 } // namespace content |
297 | 303 |
298 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ | 304 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ |
OLD | NEW |