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

Unified Diff: content/public/browser/download_url_parameters.h

Issue 1751603002: [Downloads] Rework how hashes are calculated for download files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try to appease MSVC 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 side-by-side diff with in-line comments
Download patch
Index: content/public/browser/download_url_parameters.h
diff --git a/content/public/browser/download_url_parameters.h b/content/public/browser/download_url_parameters.h
index 5734e91cd2d1059694eeb8d85265cb4dcf962dbc..a5e44fc879b6cd5f118dff3d1f4f94d0e66814ff 100644
--- a/content/public/browser/download_url_parameters.h
+++ b/content/public/browser/download_url_parameters.h
@@ -155,8 +155,19 @@ class CONTENT_EXPORT DownloadUrlParameters {
// If |offset| is non-zero, then a byte range request will be issued to fetch
// the range of bytes starting at |offset| through to the end of thedownload.
void set_offset(int64_t offset) { save_info_.offset = offset; }
- void set_hash_state(const std::string& hash_state) {
- save_info_.hash_state = hash_state;
+
+ // If |offset| is non-zero, then |prefix_hash| indicates the SHA-256 hash of
+ // the first |offset| bytes of the target file that is expected by the caller.
+ void set_prefix_hash(const std::string& prefix_hash) {
+ save_info_.prefix_hash = prefix_hash;
+ }
+
+ // If |offset| is non-zero, then |hash_state| indicates the SHA-256 hash state
+ // of the first |offset| bytes of teh target file. In this case, the prefix
svaldez 2016/03/09 19:27:34 *the
asanka 2016/03/10 16:48:08 Done.
+ // hash will be ignored since the |hash_state| is assumed to be correct if
+ // provided.
+ void set_hash_state(scoped_ptr<crypto::SecureHash> hash_state) {
+ save_info_.hash_state = std::move(hash_state);
}
// If |prompt| is true, then the user will be prompted for a filename. Ignored
@@ -191,14 +202,14 @@ class CONTENT_EXPORT DownloadUrlParameters {
return save_info_.suggested_name;
}
int64_t offset() const { return save_info_.offset; }
- const std::string& hash_state() const { return save_info_.hash_state; }
+ const std::string& prefix_hash() const { return save_info_.prefix_hash; }
bool prompt() const { return save_info_.prompt_for_save_location; }
const GURL& url() const { return url_; }
bool do_not_prompt_for_login() const { return do_not_prompt_for_login_; }
- // Note that this is state changing--the DownloadUrlParameters object
- // will not have a file attached to it after this call.
- base::File GetFile() { return std::move(save_info_.file); }
+ // STATE CHANGING: All save_info_ sub-objects will be in an indeterminate
+ // state following this call.
+ DownloadSaveInfo GetSaveInfo() { return std::move(save_info_); }
private:
OnStartedCallback callback_;

Powered by Google App Engine
This is Rietveld 408576698