| Index: chrome/browser/download/download_manager.h
|
| diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h
|
| index 828c83c3bdda7d7f630618b3143257e02834de4e..b5b220e8b93b932a3cad710f6e54d43388094993 100644
|
| --- a/chrome/browser/download/download_manager.h
|
| +++ b/chrome/browser/download/download_manager.h
|
| @@ -123,9 +123,22 @@ class DownloadManager
|
| void OnResponseCompleted(int32 download_id, int64 size, int os_error,
|
| const std::string& hash);
|
|
|
| - // Called from a view when a user clicks a UI button or link.
|
| - void DownloadCancelled(int32 download_id);
|
| - void RemoveDownload(int64 download_handle);
|
| + // 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(int32 download_id);
|
| +
|
| + // 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
|
| @@ -267,10 +280,6 @@ class DownloadManager
|
| DownloadItem* GetDownloadItem(int id);
|
|
|
| private:
|
| - // For testing.
|
| - friend class DownloadManagerTest;
|
| - friend class MockDownloadManager;
|
| -
|
| // This class is used to let an incognito DownloadManager observe changes to
|
| // a normal DownloadManager, to propagate ModelChanged() calls from the parent
|
| // DownloadManager to the observers of the incognito DownloadManager.
|
| @@ -296,6 +305,11 @@ class DownloadManager
|
| friend class DeleteTask<DownloadManager>;
|
| friend class OtherDownloadManagerObserver;
|
|
|
| + // For testing.
|
| + friend class DownloadManagerTest;
|
| + friend class MockDownloadManager;
|
| + friend class DownloadTest;
|
| +
|
| virtual ~DownloadManager();
|
|
|
| // Called on the FILE thread to check the existence of a downloaded file.
|
| @@ -324,10 +338,6 @@ class DownloadManager
|
| void ContinueDownloadWithPath(DownloadItem* download,
|
| const FilePath& chosen_file);
|
|
|
| - // Download cancel helper function.
|
| - void DownloadCancelledInternal(int download_id,
|
| - const DownloadRequestHandle& request_handle);
|
| -
|
| // All data has been downloaded.
|
| // |hash| is sha256 hash for the downloaded file. It is empty when the hash
|
| // is not available.
|
| @@ -342,6 +352,16 @@ class DownloadManager
|
| // 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);
|
| +
|
| + // Replace the file selection dialog used for the download manager.
|
| + // This is intended to be used for testing only.
|
| + void SetSelectFileDialog(scoped_refptr<SelectFileDialog> file_dialog);
|
| +
|
| // Get the download item from the active map. Useful when the item is not
|
| // yet in the history map.
|
| DownloadItem* GetActiveDownloadItem(int id);
|
|
|