Index: content/browser/download/download_item.h |
diff --git a/content/browser/download/download_item.h b/content/browser/download/download_item.h |
index 6e32d0890fbdd656321ef094530dcb260fc04062..1262fba65f02be7a40c35a08f95e5abd1691eb9c 100644 |
--- a/content/browser/download/download_item.h |
+++ b/content/browser/download/download_item.h |
@@ -156,16 +156,11 @@ class DownloadItem { |
// Received a new chunk of data |
void Update(int64 bytes_so_far); |
- // Cancel the download operation. We need to distinguish between cancels at |
- // exit (DownloadManager destructor) from user interface initiated cancels |
- // because at exit, the history system may not exist, and any updates to it |
- // require AddRef'ing the DownloadManager in the destructor which results in |
- // a DCHECK failure. Set 'update_history' to false when canceling from at |
- // exit to prevent this crash. This may result in a difference between the |
- // downloaded file's size on disk, and what the history system's last record |
- // of it is. At worst, we'll end up re-downloading a small portion of the file |
- // when resuming a download (assuming the server supports byte ranges). |
- void Cancel(bool update_history); |
+ // Cancel the download operation. This may be called at any time; if |
+ // it is called before all download attributes have been finalized and |
+ // the download entered into the history, it will remove the download from |
+ // the system. |
+ void Cancel(); |
// Called by external code (SavePackage) using the DownloadItem interface |
// to display progress when the DownloadItem should be considered complete. |
@@ -181,10 +176,14 @@ class DownloadItem { |
// Called when the downloaded file is removed. |
void OnDownloadedFileRemoved(); |
- // Download operation had an error. |
- // |size| is the amount of data received at interruption. |
- // |error| is the network error code that the operation received. |
- void Interrupted(int64 size, net::Error error); |
+ // Download operation had an error; call to interrupt the processing. |
+ // Note that if the download attributes haven't yet been finalized and |
+ // the download entered into the history (which implies that it hasn't |
+ // yet been made visible in the UI), this call will remove the |
+ // download from the system. |
+ // |size| is the amount of data received so far, and |os_error| is the error |
ahendrickson
2011/09/11 15:57:02
Nit: |net_error| (or change it to |error|, as it w
Randy Smith (Not in Mondays)
2011/09/12 18:00:27
Done.
|
+ // code that the operation received. |
+ void Interrupt(int64 size, net::Error net_error); |
// 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 |
@@ -346,6 +345,10 @@ class DownloadItem { |
// Internal helper for maintaining consistent received and total sizes. |
void UpdateSize(int64 size); |
+ // Internal function to do the main work of cancelling or |
+ // interrupting a download. |
+ void StopInternal(DownloadState target_state); |
+ |
// Called when the entire download operation (including renaming etc) |
// is completed. |
void Completed(); |