| Index: content/browser/download/download_manager.h
|
| diff --git a/content/browser/download/download_manager.h b/content/browser/download/download_manager.h
|
| index 52d36ce0ee61e8fa98d671a4e7f1b63ff06ea04d..57b668d692c7f84f8c016ea7dc78d6f341cf5623 100644
|
| --- a/content/browser/download/download_manager.h
|
| +++ b/content/browser/download/download_manager.h
|
| @@ -121,22 +121,28 @@ class DownloadManager
|
| void OnResponseCompleted(int32 download_id, int64 size,
|
| const std::string& hash);
|
|
|
| - // Offthread target for cancelling a particular download. Will be a no-op
|
| - // if the download has already been cancelled.
|
| - void CancelDownload(int32 download_id);
|
| -
|
| // Called when there is an error in the download.
|
| // |download_id| is the ID of the download.
|
| // |size| is the number of bytes that are currently downloaded.
|
| // |error| is a download error code. Indicates what caused the interruption.
|
| void OnDownloadError(int32 download_id, int64 size, net::Error error);
|
|
|
| - // Called from DownloadItem to handle the DownloadManager portion of a
|
| - // Cancel; should not be called from other locations.
|
| - void DownloadCancelledInternal(DownloadItem* download);
|
| + // Called to initiate download cancel on behalf of an off-thread portion
|
| + // of the download system; redirects to DownloadItem.
|
| + void CancelDownload(int32 download_handle);
|
| +
|
| + // This routine is called from the DownloadItem when a
|
| + // request is cancelled or interrupted. It removes the download
|
| + // from all internal queues holding in-progress work, and takes care
|
| + // of the off-thread aspects of the cancel (stopping the request,
|
| + // cancelling the download on the file thread).
|
| + void DownloadStopped(DownloadItem* download);
|
|
|
| - // Called from a view when a user clicks a UI button or link.
|
| - void RemoveDownload(int64 download_handle);
|
| + // Called from DownloadItem when the download is being removed.
|
| + // Takes care of all history operations, modifying internal queues,
|
| + // and notifying DownloadManager observers, and actually deletes
|
| + // the DownloadItem.
|
| + void RemoveDownload(DownloadItem* download);
|
|
|
| // Determine if the download is ready for completion, i.e. has had
|
| // all data saved, and completed the filename determination and
|
| @@ -272,14 +278,14 @@ class DownloadManager
|
| typedef std::set<DownloadItem*> DownloadSet;
|
| typedef base::hash_map<int64, DownloadItem*> DownloadMap;
|
|
|
| + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
|
| + friend class DeleteTask<DownloadManager>;
|
| +
|
| // For testing.
|
| friend class DownloadManagerTest;
|
| friend class MockDownloadManager;
|
| friend class DownloadTest;
|
|
|
| - friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
|
| - friend class DeleteTask<DownloadManager>;
|
| -
|
| void set_delegate(DownloadManagerDelegate* delegate) { delegate_ = delegate; }
|
|
|
| virtual ~DownloadManager();
|
| @@ -307,17 +313,18 @@ class DownloadManager
|
| // Returns NULL if the download is not active.
|
| DownloadItem* GetActiveDownload(int32 download_id);
|
|
|
| - // Removes |download| from the active and in progress maps.
|
| - // Called when the download is cancelled or has an error.
|
| - // Does nothing if the download is not in the history DB.
|
| - void RemoveFromActiveList(DownloadItem* download);
|
| -
|
| // Updates the delegate about the overall download progress.
|
| void UpdateDownloadProgress();
|
|
|
| // Inform observers that the model has changed.
|
| void NotifyModelChanged();
|
|
|
| + // Return all in progress downloads. This includes downloads that
|
| + // have not yet been entered into the history (all other accessors
|
| + // only return downloads that have been entered into the history).
|
| + // This is intended to be used for testing only.
|
| + void GetInProgressDownloads(std::vector<DownloadItem*>* result);
|
| +
|
| // Debugging routine to confirm relationship between below
|
| // containers; no-op if NDEBUG.
|
| void AssertContainersConsistent() const;
|
|
|