Index: chrome/browser/download/download_item.h |
diff --git a/chrome/browser/download/download_item.h b/chrome/browser/download/download_item.h |
index 3431bc7976fc57c74e1fc26620a57b3dbd26f758..d3660ed58caddfcb9be9f844439407af0b41752d 100644 |
--- a/chrome/browser/download/download_item.h |
+++ b/chrome/browser/download/download_item.h |
@@ -39,7 +39,8 @@ class DownloadItem { |
IN_PROGRESS, |
COMPLETE, |
CANCELLED, |
- REMOVING |
+ REMOVING, |
+ INTERRUPTED |
}; |
enum SafetyState { |
@@ -60,6 +61,9 @@ class DownloadItem { |
// Called when a downloaded file has been opened. |
virtual void OnDownloadOpened(DownloadItem* download) = 0; |
+ // Called when a downloaded file has been interrupted (had an error). |
+ virtual void OnDownloadInterrupted(DownloadItem* download) = 0; |
+ |
protected: |
virtual ~Observer() {} |
}; |
@@ -132,6 +136,15 @@ class DownloadItem { |
// is finished. |
void Finished(); |
+ // Download operation had an error. |
+ // |size| is the amount of data received so far, and |os_error| is the error |
+ // code that the operation received. |
+ void Interrupted(int64 size, int os_error); |
+ |
+ // User has resumed a download after an interruption. |
+ // |new_request_id| is the new request ID associated with the download. |
+ void Resumed(int new_request_id); |
+ |
// The user wants to remove the download from the views and history. If |
// |delete_file| is true, the file is deleted on the disk. |
void Remove(bool delete_file); |
@@ -162,6 +175,9 @@ class DownloadItem { |
// Returns true if this item matches |query|. |query| must be lower-cased. |
bool MatchesQuery(const string16& query) const; |
+ bool IsPartialDownload() const; |
+ bool IsInterruptedDownload() const; |
+ |
// Accessors |
DownloadState state() const { return state_; } |
FilePath full_path() const { return full_path_; } |
@@ -173,6 +189,7 @@ class DownloadItem { |
int64 total_bytes() const { return total_bytes_; } |
void set_total_bytes(int64 total_bytes) { total_bytes_ = total_bytes; } |
int64 received_bytes() const { return received_bytes_; } |
+ int last_os_error() const { return last_os_error_; } |
int32 id() const { return id_; } |
base::Time start_time() const { return start_time_; } |
void set_db_handle(int64 handle) { db_handle_ = handle; } |
@@ -247,6 +264,9 @@ class DownloadItem { |
// Current received bytes |
int64 received_bytes_; |
+ // Last error. |
+ int last_os_error_; |
+ |
// Start time for calculating remaining time |
base::TimeTicks start_tick_; |