Index: chrome/browser/download/download_manager.h |
diff --git a/chrome/browser/download/download_manager.h b/chrome/browser/download/download_manager.h |
index a9ddefa878834a0c1b4715e01354c48ff33712f7..b673925e4c61ddb64c7eaae6ab82da9cbe971a77 100644 |
--- a/chrome/browser/download/download_manager.h |
+++ b/chrome/browser/download/download_manager.h |
@@ -122,9 +122,19 @@ 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, and takes care of the off-thread aspects |
Randy Smith (Not in Mondays)
2011/06/30 23:05:13
Not all internal queues, just the ones representin
Randy Smith (Not in Mondays)
2011/07/05 20:28:44
Done.
|
+ // 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. |
Randy Smith (Not in Mondays)
2011/06/30 23:05:13
A bit more detail as to what it does.
Randy Smith (Not in Mondays)
2011/07/05 20:28:44
Done.
|
+ 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 |
@@ -266,10 +276,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. |
@@ -295,6 +301,13 @@ class DownloadManager |
friend class DeleteTask<DownloadManager>; |
friend class OtherDownloadManagerObserver; |
+ // For testing. |
+ friend class DownloadManagerTest; |
+ friend class MockDownloadManager; |
+ FRIEND_TEST_ALL_PREFIXES(DownloadTest, CancelFromFileSelection); |
+ FRIEND_TEST_ALL_PREFIXES(DownloadTest, RemoveFromFileSelection); |
+ FRIEND_TEST_ALL_PREFIXES(DownloadTest, InterruptFromFileSelection); |
+ |
virtual ~DownloadManager(); |
// Called on the FILE thread to check the existence of a downloaded file. |
@@ -323,12 +336,6 @@ class DownloadManager |
void ContinueDownloadWithPath(DownloadItem* download, |
const FilePath& chosen_file); |
- // Download cancel helper function. |
- // |request_handle| is passed by value because it is ultimately passed to |
- // other threads, and this way we don't have to worry about object lifetimes. |
- void DownloadCancelledInternal(int download_id, |
- 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. |
@@ -343,6 +350,12 @@ 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); |
+ |
// Get the download item from the active map. Useful when the item is not |
// yet in the history map. |
DownloadItem* GetActiveDownloadItem(int id); |