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

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

Issue 2660783002: Range request support for parallel download in DownloadRequestCore. (Closed)
Patch Set: Strong validator for all range request. Created 3 years, 10 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 9
10 #include <memory> 10 #include <memory>
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
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| through to the end of the download.
172 void set_offset(int64_t offset) { save_info_.offset = offset; } 172 void set_offset(int64_t offset) { save_info_.offset = offset; }
173 173
174 void set_length(int64_t length) { save_info_.length = length; }
David Trainor- moved to gerrit 2017/02/01 07:14:36 Add a comment here along the lines of the one in D
xingliu 2017/02/01 20:25:46 Done. Also added some comment for set_offset.
175
174 // If |offset| is non-zero, then |hash_of_partial_file| contains the raw 176 // 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 177 // 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 178 // meaningful if a partial file exists and is identified by either the
177 // |file_path()| or |file()|. 179 // |file_path()| or |file()|.
178 void set_hash_of_partial_file(const std::string& hash_of_partial_file) { 180 void set_hash_of_partial_file(const std::string& hash_of_partial_file) {
179 save_info_.hash_of_partial_file = hash_of_partial_file; 181 save_info_.hash_of_partial_file = hash_of_partial_file;
180 } 182 }
181 183
182 // If |offset| is non-zero, then |hash_state| indicates the SHA-256 hash state 184 // 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 185 // 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
232 234
233 const RequestHeadersType& request_headers() const { return request_headers_; } 235 const RequestHeadersType& request_headers() const { return request_headers_; }
234 net::URLRequestContextGetter* url_request_context_getter() { 236 net::URLRequestContextGetter* url_request_context_getter() {
235 return url_request_context_getter_.get(); 237 return url_request_context_getter_.get();
236 } 238 }
237 const base::FilePath& file_path() const { return save_info_.file_path; } 239 const base::FilePath& file_path() const { return save_info_.file_path; }
238 const base::string16& suggested_name() const { 240 const base::string16& suggested_name() const {
239 return save_info_.suggested_name; 241 return save_info_.suggested_name;
240 } 242 }
241 int64_t offset() const { return save_info_.offset; } 243 int64_t offset() const { return save_info_.offset; }
244 int64_t length() const { return save_info_.length; }
242 const std::string& hash_of_partial_file() const { 245 const std::string& hash_of_partial_file() const {
243 return save_info_.hash_of_partial_file; 246 return save_info_.hash_of_partial_file;
244 } 247 }
245 bool prompt() const { return save_info_.prompt_for_save_location; } 248 bool prompt() const { return save_info_.prompt_for_save_location; }
246 const GURL& url() const { return url_; } 249 const GURL& url() const { return url_; }
247 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; } 250 bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; }
248 251
249 // STATE_CHANGING: Return the BlobDataHandle. 252 // STATE_CHANGING: Return the BlobDataHandle.
250 std::unique_ptr<storage::BlobDataHandle> GetBlobDataHandle() { 253 std::unique_ptr<storage::BlobDataHandle> GetBlobDataHandle() {
251 return std::move(blob_data_handle_); 254 return std::move(blob_data_handle_);
(...skipping 24 matching lines...) Expand all
276 GURL url_; 279 GURL url_;
277 bool do_not_prompt_for_login_; 280 bool do_not_prompt_for_login_;
278 std::unique_ptr<storage::BlobDataHandle> blob_data_handle_; 281 std::unique_ptr<storage::BlobDataHandle> blob_data_handle_;
279 282
280 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters); 283 DISALLOW_COPY_AND_ASSIGN(DownloadUrlParameters);
281 }; 284 };
282 285
283 } // namespace content 286 } // namespace content
284 287
285 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ 288 #endif // CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698