Chromium Code Reviews| Index: content/browser/download/base_file.h |
| diff --git a/content/browser/download/base_file.h b/content/browser/download/base_file.h |
| index 2a0994358055c89d9f84c59b1fca13c4f5076f5e..493099630bbd7e32aa130e46132ccde32a6cea47 100644 |
| --- a/content/browser/download/base_file.h |
| +++ b/content/browser/download/base_file.h |
| @@ -33,6 +33,7 @@ class CONTENT_EXPORT BaseFile { |
| const GURL& source_url, |
| const GURL& referrer_url, |
| int64 received_bytes, |
| + const std::string& hash_state, |
| const linked_ptr<net::FileStream>& file_stream); |
| virtual ~BaseFile(); |
| @@ -65,10 +66,16 @@ class CONTENT_EXPORT BaseFile { |
| bool in_progress() const { return file_stream_ != NULL; } |
| int64 bytes_so_far() const { return bytes_so_far_; } |
| - // Set |hash| with sha256 digest for the file. |
| + // Fills |hash| with the sha256 digest for the file. |
| // Returns true if digest is successfully calculated. |
| virtual bool GetSha256Hash(std::string* hash); |
| + // Returns the current (intermediate) state of the hash as a byte string. |
| + virtual std::string GetSha256HashState(); |
| + |
| + // Resets the current state of the hash to the contents of |hash_state_bytes|. |
| + virtual bool SetSha256HashState(const std::string& hash_state_bytes); |
|
Randy Smith (Not in Mondays)
2011/11/22 17:37:49
Given that this is also in the constructor, is thi
ahendrickson
2011/11/22 23:46:44
It doesn't actually get set in the constructor, bu
Randy Smith (Not in Mondays)
2011/11/23 19:25:13
Then shouldn't it be private? I'm good with eithe
ahendrickson
2011/12/20 00:04:14
Made it private.
|
| + |
| // Returns true if the given hash is considered empty. An empty hash is |
| // a string of size kSha256HashLen that contains only zeros (initial value |
| // for the hash). |
| @@ -114,6 +121,9 @@ class CONTENT_EXPORT BaseFile { |
| // is set. |
| scoped_ptr<crypto::SecureHash> secure_hash_; |
| + // The hash state is stored here on creation. |
| + std::string initial_hash_state_; |
|
Randy Smith (Not in Mondays)
2011/11/22 17:37:49
Why can't you just unpickle in the constructor dir
ahendrickson
2011/11/22 23:46:44
Initialize() would reset it.
Randy Smith (Not in Mondays)
2011/11/23 19:25:13
That seems like an incomplete answer, since we con
ahendrickson
2011/12/20 00:04:14
Moved the hash initialization into the constructor
|
| + |
| unsigned char sha256_hash_[kSha256HashLen]; |
| // Indicates that this class no longer owns the associated file, and so |