Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: content/browser/download/download_manager.h

Issue 8817005: Revert 113007 - DownloadManager intereface refactoring to allow cleaner DownloadItem unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/download/download_item_impl.cc ('k') | content/browser/download/download_manager_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_manager.h
===================================================================
--- content/browser/download/download_manager.h (revision 113083)
+++ content/browser/download/download_manager.h (working copy)
@@ -124,8 +124,26 @@
// |size| is the number of bytes that are currently downloaded.
// |reason| is a download interrupt reason code.
virtual void OnDownloadInterrupted(int32 download_id, int64 size,
- InterruptReason reason) = 0;
+ InterruptReason reason) = 0;
+ // Called from DownloadItem to handle the DownloadManager portion of a
+ // Cancel; should not be called from other locations.
+ virtual void DownloadCancelledInternal(DownloadItem* download) = 0;
+
+ // Called from a view when a user clicks a UI button or link.
+ virtual void RemoveDownload(int64 download_handle) = 0;
+
+ // Determine if the download is ready for completion, i.e. has had
+ // all data saved, and completed the filename determination and
+ // history insertion.
+ virtual bool IsDownloadReadyForCompletion(DownloadItem* download) = 0;
+
+ // If all pre-requisites have been met, complete download processing, i.e.
+ // do internal cleanup, file rename, and potentially auto-open.
+ // (Dangerous downloads still may block on user acceptance after this
+ // point.)
+ virtual void MaybeCompleteDownload(DownloadItem* download) = 0;
+
// Called when the download is renamed to its final name.
// |uniquifier| is a number used to make unique names for the file. It is
// only valid for the DANGEROUS_BUT_VALIDATED state of the download item.
@@ -148,6 +166,10 @@
// deleted is returned back to the caller.
virtual int RemoveAllDownloads() = 0;
+ // Final download manager transition for download: Update the download
+ // history and remove the download from |active_downloads_|.
+ virtual void DownloadCompleted(int32 download_id) = 0;
+
// Download the object at the URL. Used in cases such as "Save Link As..."
virtual void DownloadUrl(const GURL& url,
const GURL& referrer,
@@ -179,27 +201,20 @@
virtual void OnItemAddedToPersistentStore(int32 download_id,
int64 db_handle) = 0;
+ // Display a new download in the appropriate browser UI.
+ virtual void ShowDownloadInBrowser(DownloadItem* download) = 0;
+
// The number of in progress (including paused) downloads.
virtual int InProgressCount() const = 0;
- virtual content::BrowserContext* BrowserContext() const = 0;
+ virtual content::BrowserContext* BrowserContext() = 0;
virtual FilePath LastDownloadPath() = 0;
// Creates the download item. Must be called on the UI thread.
- virtual void CreateDownloadItem(
- DownloadCreateInfo* info,
- const DownloadRequestHandle& request_handle) = 0;
+ virtual void CreateDownloadItem(DownloadCreateInfo* info,
+ const DownloadRequestHandle& request_handle) = 0;
- // Creates a download item for the SavePackage system.
- // Must be called on the UI thread. Note that the DownloadManager
- // retains ownership.
- virtual DownloadItem* CreateSavePackageDownloadItem(
- const FilePath& main_file_path,
- const GURL& page_url,
- bool is_otr,
- DownloadItem::Observer* observer) = 0;
-
// Clears the last download path, used to initialize "save as" dialogs.
virtual void ClearLastDownloadPath() = 0;
@@ -211,15 +226,31 @@
// DownloadManagerDelegate::ShouldStartDownload and now is ready.
virtual void RestartDownload(int32 download_id) = 0;
+ // Mark the download opened in the persistent store.
+ virtual void MarkDownloadOpened(DownloadItem* download) = 0;
+
// Checks whether downloaded files still exist. Updates state of downloads
// that refer to removed files. The check runs in the background and may
// finish asynchronously after this method returns.
virtual void CheckForHistoryFilesRemoval() = 0;
+ // Checks whether a downloaded file still exists and updates the file's state
+ // if the file is already removed. The check runs in the background and may
+ // finish asynchronously after this method returns.
+ virtual void CheckForFileRemoval(DownloadItem* download_item) = 0;
+
+ // Assert the named download item is on the correct queues
+ // in the DownloadManager. For debugging.
+ virtual void AssertQueueStateConsistent(DownloadItem* download) = 0;
+
// Get the download item from the history map. Useful after the item has
// been removed from the active map, or was retrieved from the history DB.
virtual DownloadItem* GetDownloadItem(int id) = 0;
+ // Called when Save Page download starts. Transfers ownership of |download|
+ // to the DownloadManager.
+ virtual void SavePageDownloadStarted(DownloadItem* download) = 0;
+
// Called when Save Page download is done.
virtual void SavePageDownloadFinished(DownloadItem* download) = 0;
@@ -234,6 +265,8 @@
virtual void SetDownloadManagerDelegate(
content::DownloadManagerDelegate* delegate) = 0;
+ virtual DownloadId GetNextId() = 0;
+
protected:
// These functions are here for unit tests.
« no previous file with comments | « content/browser/download/download_item_impl.cc ('k') | content/browser/download/download_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698