| Index: chrome/browser/download/base_file.h
|
| ===================================================================
|
| --- chrome/browser/download/base_file.h (revision 70630)
|
| +++ chrome/browser/download/base_file.h (working copy)
|
| @@ -10,6 +10,8 @@
|
|
|
| #include "base/file_path.h"
|
| #include "base/linked_ptr.h"
|
| +#include "base/scoped_ptr.h"
|
| +#include "base/third_party/nss/blapi.h"
|
| #include "chrome/browser/power_save_blocker.h"
|
| #include "googleurl/src/gurl.h"
|
|
|
| @@ -28,7 +30,8 @@
|
| const linked_ptr<net::FileStream>& file_stream);
|
| ~BaseFile();
|
|
|
| - bool Initialize();
|
| + // If calculate_hash is true, sha256 hash will be calculated.
|
| + bool Initialize(bool calculate_hash);
|
|
|
| // Write a new chunk of data to the file. Returns true on success (all bytes
|
| // written to the file).
|
| @@ -53,6 +56,10 @@
|
| 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.
|
| + // Returns true if digest is successfully calculated.
|
| + virtual bool GetSha256Hash(std::string* hash);
|
| +
|
| virtual std::string DebugString() const;
|
|
|
| protected:
|
| @@ -66,6 +73,8 @@
|
| bool path_renamed_;
|
|
|
| private:
|
| + static const size_t kSha256HashLen = 32;
|
| +
|
| // Source URL for the file being downloaded.
|
| GURL source_url_;
|
|
|
| @@ -81,6 +90,15 @@
|
| // RAII handle to keep the system from sleeping while we're downloading.
|
| PowerSaveBlocker power_save_blocker_;
|
|
|
| + // Indicates if sha256 hash should be calculated for the file.
|
| + bool calculate_hash_;
|
| +
|
| + // Used to calculate sha256 hash for the file when calculate_hash_
|
| + // is set.
|
| + scoped_ptr<SHA256Context> sha_context_;
|
| +
|
| + unsigned char sha256_hash_[kSha256HashLen];
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(BaseFile);
|
| };
|
|
|
|
|
| Property changes on: chrome/browser/download/base_file.h
|
| ___________________________________________________________________
|
| Added: svn:eol-style
|
| + LF
|
|
|
|
|