| Index: content/browser/download/base_file.cc
|
| diff --git a/content/browser/download/base_file.cc b/content/browser/download/base_file.cc
|
| index 51121001de8b64534119d8a7fb99411b77f7e324..0c63fc7967ca8d79eba431b951abae0f95682f58 100644
|
| --- a/content/browser/download/base_file.cc
|
| +++ b/content/browser/download/base_file.cc
|
| @@ -193,6 +193,7 @@ BaseFile::BaseFile(const FilePath& full_path,
|
| const GURL& source_url,
|
| const GURL& referrer_url,
|
| int64 received_bytes,
|
| + const std::string& initial_hash,
|
| const linked_ptr<net::FileStream>& file_stream)
|
| : full_path_(full_path),
|
| source_url_(source_url),
|
| @@ -203,7 +204,10 @@ BaseFile::BaseFile(const FilePath& full_path,
|
| calculate_hash_(false),
|
| detached_(false) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
|
| - memcpy(sha256_hash_, kEmptySha256Hash, kSha256HashLen);
|
| + if (initial_hash.empty() || IsEmptySha256Hash(initial_hash))
|
| + memcpy(sha256_hash_, kEmptySha256Hash, kSha256HashLen);
|
| + else
|
| + memcpy(sha256_hash_, initial_hash.c_str(), kSha256HashLen);
|
| if (file_stream_.get())
|
| file_stream_->EnableErrorStatistics();
|
| }
|
| @@ -387,7 +391,7 @@ bool BaseFile::GetSha256Hash(std::string* hash) {
|
| DCHECK(!detached_);
|
| hash->assign(reinterpret_cast<const char*>(sha256_hash_),
|
| sizeof(sha256_hash_));
|
| - return (calculate_hash_ && !in_progress());
|
| + return (calculate_hash_);
|
| }
|
|
|
| bool BaseFile::IsEmptySha256Hash(const std::string& hash) {
|
|
|