Chromium Code Reviews| Index: content/browser/download/download_item.h |
| diff --git a/content/browser/download/download_item.h b/content/browser/download/download_item.h |
| index 3d3b0e7ace3a8b7454f1f7cc31088b3a2c5cc6e7..0cd0fcbc405a5ab4bab12acf9b5cc17207bd51ac 100644 |
| --- a/content/browser/download/download_item.h |
| +++ b/content/browser/download/download_item.h |
| @@ -163,8 +163,11 @@ class CONTENT_EXPORT DownloadItem { |
| // Called when the user has validated the download of a dangerous file. |
| void DangerousDownloadValidated(); |
| - // Received a new chunk of data |
| - void Update(int64 bytes_so_far); |
| + // Received a new chunk of data. |
| + // |bytes_so_far| is the number of bytes received so far. |
| + // |partial_hash| is the hash up to this point. It will be an empty string |
| + // if we are not calculating hashes. |
| + void Update(int64 bytes_so_far, const std::string& partial_hash); |
| // Cancel the download operation. We need to distinguish between cancels at |
| // exit (DownloadManager destructor) from user interface initiated cancels |
| @@ -193,8 +196,11 @@ class CONTENT_EXPORT DownloadItem { |
| // Download operation had an error. |
| // |size| is the amount of data received at interruption. |
| + // |partial_hash| is the current hash value at interruption. |
| // |reason| is the download interrupt reason code that the operation received. |
| - void Interrupted(int64 size, InterruptReason reason); |
| + void Interrupted(int64 size, |
| + const std::string partial_hash, |
| + InterruptReason reason); |
| // Deletes the file from disk and removes the download from the views and |
| // history. |user| should be true if this is the result of the user clicking |
| @@ -313,6 +319,13 @@ class CONTENT_EXPORT DownloadItem { |
| void set_opened(bool opened) { opened_ = opened; } |
| bool opened() const { return opened_; } |
| + const std::string& last_modified_time() const { return last_modified_time_; } |
| + void set_last_modified_time(const std::string& time) { |
| + last_modified_time_ = time; |
| + } |
| + const std::string& etag() const { return etag_; } |
| + void set_etag(const std::string& tag) { etag_ = tag; } |
|
Randy Smith (Not in Mondays)
2011/11/15 18:45:26
Under what circumstances are the setters used? Ca
ahendrickson
2011/11/16 15:41:08
We need the getters (or an equivalent function) wh
Randy Smith (Not in Mondays)
2011/11/16 18:29:27
So you're not planning to update these values when
ahendrickson
2011/11/19 20:18:03
You're right, and I'll put them back in when they
|
| + |
| InterruptReason last_reason() const { return last_reason_; } |
| DownloadPersistentStoreInfo GetPersistentStoreInfo() const; |
| @@ -357,6 +370,9 @@ class CONTENT_EXPORT DownloadItem { |
| // Internal helper for maintaining consistent received and total sizes. |
| void UpdateSize(int64 size); |
| + // Internal helper for keeping track of the hash as we receive data. |
| + void UpdateHash(const std::string& partial_hash); |
|
Randy Smith (Not in Mondays)
2011/11/15 18:45:26
Given that we worked out in a different comment th
ahendrickson
2011/11/16 15:41:08
Done.
|
| + |
| // Called when the entire download operation (including renaming etc) |
| // is completed. |
| void Completed(); |
| @@ -417,42 +433,48 @@ class CONTENT_EXPORT DownloadItem { |
| // It's used to construct a suggested filename. |
| std::string referrer_charset_; |
| - // Total bytes expected |
| + // Total bytes expected. |
| int64 total_bytes_; |
| - // Current received bytes |
| + // Current received bytes. |
| int64 received_bytes_; |
| // Sha256 hash of the content. This might be empty either because |
| - // the download isn't done yet or because the hash isn't needed |
| + // the download hasn't started yet or because the hash isn't needed |
| // (ChromeDownloadManagerDelegate::GenerateFileHash() returned false). |
| std::string hash_; |
| + // Server's time stamp for the file. |
| + std::string last_modified_time_; |
| + |
| + // Server's ETAG for the file. |
| + std::string etag_; |
| + |
| // Last reason. |
| InterruptReason last_reason_; |
| - // Start time for calculating remaining time |
| + // Start time for calculating remaining time. |
| base::TimeTicks start_tick_; |
| - // The current state of this download |
| + // The current state of this download. |
| DownloadState state_; |
| - // The views of this item in the download shelf and download tab |
| + // The views of this item in the download shelf and download tab. |
| ObserverList<Observer> observers_; |
| - // Time the download was started |
| + // Time the download was started. |
| base::Time start_time_; |
| - // Time the download completed |
| + // Time the download completed. |
| base::Time end_time_; |
| - // Our persistent store handle |
| + // Our persistent store handle. |
| int64 db_handle_; |
| - // Our owning object |
| + // Our owning object. |
| DownloadManager* download_manager_; |
| - // In progress downloads may be paused by the user, we note it here |
| + // In progress downloads may be paused by the user, we note it here. |
| bool is_paused_; |
| // A flag for indicating if the download should be opened at completion. |