Chromium Code Reviews| Index: chrome/browser/download/download_item.h |
| diff --git a/chrome/browser/download/download_item.h b/chrome/browser/download/download_item.h |
| index 9e501f29066ab044f1e85a9604450c06680065ad..b29db80adc05075bd2c7e290a4591b2a79424376 100644 |
| --- a/chrome/browser/download/download_item.h |
| +++ b/chrome/browser/download/download_item.h |
| @@ -163,16 +163,10 @@ class DownloadItem : public NotificationObserver { |
| // 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 the download has been persisted into the history |
| + // it will remove the download completely from the system. |
|
Randy Smith (Not in Mondays)
2011/06/30 23:05:13
Change comment to indicate both behaviors (before
Randy Smith (Not in Mondays)
2011/07/05 20:28:44
Changed phrasing, left assymetric specification.
|
| + void Cancel(); |
| // Called by external code (SavePackage) using the DownloadItem interface |
| // to display progress when the DownloadItem should be considered complete. |
| @@ -184,10 +178,13 @@ class DownloadItem : public NotificationObserver { |
| // Called when the downloaded file is removed. |
| void OnDownloadedFileRemoved(); |
| - // Download operation had an error. |
| + // Download operation had an error; call to interrupt the processing. |
| + // Note that if the download hasn't yet been persisted to the history |
| + // (which implies that it hasn't yet been shown to the user in the UI), |
| + // it will be completely removed. |
|
Randy Smith (Not in Mondays)
2011/06/30 23:05:13
Make this comment align with the Cancel comment.
Randy Smith (Not in Mondays)
2011/07/05 20:28:44
Done.
|
| // |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); |
| + void Interrupt(int64 size, int os_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 |
| @@ -353,6 +350,10 @@ class DownloadItem : public NotificationObserver { |
| // 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(); |