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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 save_info_.hash_state = std::move(hash_state); | 197 save_info_.hash_state = std::move(hash_state); |
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 void set_transient(bool transient) { transient_ = transient; } | |
piman
2017/04/07 20:27:58
nit: can you add documentation for this new public
| |
207 | 208 |
208 // For downloads of blob URLs, the caller can store a BlobDataHandle in the | 209 // For downloads of blob URLs, the caller can store a BlobDataHandle in the |
209 // DownloadUrlParameters object so that the blob will remain valid until | 210 // DownloadUrlParameters object so that the blob will remain valid until |
210 // the download starts. The BlobDataHandle will be attached to the associated | 211 // the download starts. The BlobDataHandle will be attached to the associated |
211 // URLRequest. | 212 // URLRequest. |
212 // | 213 // |
213 // This is optional. If left unspecified, and the blob URL cannot be mapped to | 214 // 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 | 215 // a blob by the time the download request starts, then the download will |
215 // fail. | 216 // fail. |
216 void set_blob_data_handle( | 217 void set_blob_data_handle( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
250 return save_info_.suggested_name; | 251 return save_info_.suggested_name; |
251 } | 252 } |
252 int64_t offset() const { return save_info_.offset; } | 253 int64_t offset() const { return save_info_.offset; } |
253 int64_t length() const { return save_info_.length; } | 254 int64_t length() const { return save_info_.length; } |
254 const std::string& hash_of_partial_file() const { | 255 const std::string& hash_of_partial_file() const { |
255 return save_info_.hash_of_partial_file; | 256 return save_info_.hash_of_partial_file; |
256 } | 257 } |
257 bool prompt() const { return save_info_.prompt_for_save_location; } | 258 bool prompt() const { return save_info_.prompt_for_save_location; } |
258 const GURL& url() const { return url_; } | 259 const GURL& url() const { return url_; } |
259 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } | 260 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } |
261 bool is_transient() const { return transient_; } | |
260 | 262 |
261 // STATE_CHANGING: Return the BlobDataHandle. | 263 // STATE_CHANGING: Return the BlobDataHandle. |
262 std::unique_ptr<storage::BlobDataHandle> GetBlobDataHandle() { | 264 std::unique_ptr<storage::BlobDataHandle> GetBlobDataHandle() { |
263 return std::move(blob_data_handle_); | 265 return std::move(blob_data_handle_); |
264 } | 266 } |
265 | 267 |
266 // STATE CHANGING: All save_info_ sub-objects will be in an indeterminate | 268 // STATE CHANGING: All save_info_ sub-objects will be in an indeterminate |
267 // state following this call. | 269 // state following this call. |
268 DownloadSaveInfo GetSaveInfo() { return std::move(save_info_); } | 270 DownloadSaveInfo GetSaveInfo() { return std::move(save_info_); } |
269 | 271 |
(...skipping 11 matching lines...) Expand all Loading... | |
281 Referrer referrer_; | 283 Referrer referrer_; |
282 base::Optional<url::Origin> initiator_; | 284 base::Optional<url::Origin> initiator_; |
283 std::string referrer_encoding_; | 285 std::string referrer_encoding_; |
284 int render_process_host_id_; | 286 int render_process_host_id_; |
285 int render_view_host_routing_id_; | 287 int render_view_host_routing_id_; |
286 int render_frame_host_routing_id_; | 288 int render_frame_host_routing_id_; |
287 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; | 289 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
288 DownloadSaveInfo save_info_; | 290 DownloadSaveInfo save_info_; |
289 GURL url_; | 291 GURL url_; |
290 bool do_not_prompt_for_login_; | 292 bool do_not_prompt_for_login_; |
293 bool transient_; | |
291 std::unique_ptr<storage::BlobDataHandle> blob_data_handle_; | 294 std::unique_ptr<storage::BlobDataHandle> blob_data_handle_; |
292 | 295 |
293 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); | 296 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); |
294 }; | 297 }; |
295 | 298 |
296 } // namespace content | 299 } // namespace content |
297 | 300 |
298 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ | 301 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ |
OLD | NEW |