| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 save_info_.file_path = file_path; | 161 save_info_.file_path = file_path; |
| 162 } | 162 } |
| 163 | 163 |
| 164 // Suggested filename for the download. The suggestion can be overridden by | 164 // Suggested filename for the download. The suggestion can be overridden by |
| 165 // either a Content-Disposition response header or a |file_path|. | 165 // either a Content-Disposition response header or a |file_path|. |
| 166 void set_suggested_name(const base::string16& suggested_name) { | 166 void set_suggested_name(const base::string16& suggested_name) { |
| 167 save_info_.suggested_name = suggested_name; | 167 save_info_.suggested_name = suggested_name; |
| 168 } | 168 } |
| 169 | 169 |
| 170 // If |offset| is non-zero, then a byte range request will be issued to fetch | 170 // If |offset| is non-zero, then a byte range request will be issued to fetch |
| 171 // the range of bytes starting at |offset| through to the end of thedownload. | 171 // the range of bytes starting at |offset|. |
| 172 // Use |set_length| to specify the last byte position, or the range |
| 173 // request will be "Range:bytes={offset}-" to retrieve the rest of the file. |
| 172 void set_offset(int64_t offset) { save_info_.offset = offset; } | 174 void set_offset(int64_t offset) { save_info_.offset = offset; } |
| 173 | 175 |
| 176 // When |length| > 0, the range of bytes will be from |
| 177 // |save_info_.offset| to |save_info_.offset| + |length| - 1. |
| 178 // See |DownloadSaveInfo.length|. |
| 179 void set_length(int64_t length) { save_info_.length = length; } |
| 180 |
| 174 // If |offset| is non-zero, then |hash_of_partial_file| contains the raw | 181 // If |offset| is non-zero, then |hash_of_partial_file| contains the raw |
| 175 // SHA-256 hash of the first |offset| bytes of the target file. Only | 182 // SHA-256 hash of the first |offset| bytes of the target file. Only |
| 176 // meaningful if a partial file exists and is identified by either the | 183 // meaningful if a partial file exists and is identified by either the |
| 177 // |file_path()| or |file()|. | 184 // |file_path()| or |file()|. |
| 178 void set_hash_of_partial_file(const std::string& hash_of_partial_file) { | 185 void set_hash_of_partial_file(const std::string& hash_of_partial_file) { |
| 179 save_info_.hash_of_partial_file = hash_of_partial_file; | 186 save_info_.hash_of_partial_file = hash_of_partial_file; |
| 180 } | 187 } |
| 181 | 188 |
| 182 // If |offset| is non-zero, then |hash_state| indicates the SHA-256 hash state | 189 // If |offset| is non-zero, then |hash_state| indicates the SHA-256 hash state |
| 183 // of the first |offset| bytes of the target file. In this case, the prefix | 190 // of the first |offset| bytes of the target file. In this case, the prefix |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 239 |
| 233 const RequestHeadersType& request_headers() const { return request_headers_; } | 240 const RequestHeadersType& request_headers() const { return request_headers_; } |
| 234 net::URLRequestContextGetter* url_request_context_getter() { | 241 net::URLRequestContextGetter* url_request_context_getter() { |
| 235 return url_request_context_getter_.get(); | 242 return url_request_context_getter_.get(); |
| 236 } | 243 } |
| 237 const base::FilePath& file_path() const { return save_info_.file_path; } | 244 const base::FilePath& file_path() const { return save_info_.file_path; } |
| 238 const base::string16& suggested_name() const { | 245 const base::string16& suggested_name() const { |
| 239 return save_info_.suggested_name; | 246 return save_info_.suggested_name; |
| 240 } | 247 } |
| 241 int64_t offset() const { return save_info_.offset; } | 248 int64_t offset() const { return save_info_.offset; } |
| 249 int64_t length() const { return save_info_.length; } |
| 242 const std::string& hash_of_partial_file() const { | 250 const std::string& hash_of_partial_file() const { |
| 243 return save_info_.hash_of_partial_file; | 251 return save_info_.hash_of_partial_file; |
| 244 } | 252 } |
| 245 bool prompt() const { return save_info_.prompt_for_save_location; } | 253 bool prompt() const { return save_info_.prompt_for_save_location; } |
| 246 const GURL& url() const { return url_; } | 254 const GURL& url() const { return url_; } |
| 247 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } | 255 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } |
| 248 | 256 |
| 249 // STATE_CHANGING: Return the BlobDataHandle. | 257 // STATE_CHANGING: Return the BlobDataHandle. |
| 250 std::unique_ptr<storage::BlobDataHandle> GetBlobDataHandle() { | 258 std::unique_ptr<storage::BlobDataHandle> GetBlobDataHandle() { |
| 251 return std::move(blob_data_handle_); | 259 return std::move(blob_data_handle_); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 276 GURL url_; | 284 GURL url_; |
| 277 bool do_not_prompt_for_login_; | 285 bool do_not_prompt_for_login_; |
| 278 std::unique_ptr<storage::BlobDataHandle> blob_data_handle_; | 286 std::unique_ptr<storage::BlobDataHandle> blob_data_handle_; |
| 279 | 287 |
| 280 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); | 288 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); |
| 281 }; | 289 }; |
| 282 | 290 |
| 283 } // namespace content | 291 } // namespace content |
| 284 | 292 |
| 285 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ | 293 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ |
| OLD | NEW |