Index: content/browser/download/download_file.h |
diff --git a/content/browser/download/download_file.h b/content/browser/download/download_file.h |
index 22d646e96ba64d0a3bcde5a7977c13d16a1d2622..1bbde02bd6d50a9b366414ba34f2424c945d1c83 100644 |
--- a/content/browser/download/download_file.h |
+++ b/content/browser/download/download_file.h |
@@ -11,7 +11,6 @@ |
#include "base/callback_forward.h" |
#include "base/file_path.h" |
#include "content/common/content_export.h" |
-#include "content/public/browser/download_id.h" |
#include "content/public/browser/download_interrupt_reasons.h" |
namespace content { |
@@ -24,6 +23,12 @@ class DownloadManager; |
// cancelled, the DownloadFile is destroyed. |
class CONTENT_EXPORT DownloadFile { |
public: |
+ // Callback used with Initialize. On a successful initialize, |reason| will |
+ // be DOWNLOAD_INTERRUPT_REASON_NONE; on a failed initialize, it will be |
+ // set to the reason for the failure. |
+ typedef base::Callback<void(DownloadInterruptReason reason)> |
+ InitializeCallback; |
+ |
// Callback used with Rename(). On a successful rename |reason| will be |
// DOWNLOAD_INTERRUPT_REASON_NONE and |path| the path the rename |
// was done to. On a failed rename, |reason| will contain the |
@@ -36,7 +41,7 @@ class CONTENT_EXPORT DownloadFile { |
// Returns DOWNLOAD_INTERRUPT_REASON_NONE on success, or a network |
// error code on failure. Upon completion, |callback| will be |
// called on the UI thread as per the comment above. |
- virtual content::DownloadInterruptReason Initialize() = 0; |
+ virtual void Initialize(const InitializeCallback& callback) = 0; |
// Rename the download file to |full_path|. If that file exists and |
// |overwrite_existing_file| is false, |full_path| will be uniquified by |
@@ -69,14 +74,14 @@ class CONTENT_EXPORT DownloadFile { |
// Returns the current (intermediate) state of the hash as a byte string. |
virtual std::string GetHashState() = 0; |
- // Cancels the download request associated with this file. |
- virtual void CancelDownloadRequest() = 0; |
- |
- virtual int Id() const = 0; |
- virtual DownloadManager* GetDownloadManager() = 0; |
- virtual const DownloadId& GlobalId() const = 0; |
+ // For testing. Must be called on FILE thread. |
+ // TODO(rdsmith): Replace use of EnsureNoPendingDownloads() |
+ // on the DownloadManager with a test-specific DownloadFileFactory |
+ // which keeps track of the number of DownloadFiles. |
+ static int GetNumberOfDownloadFiles(); |
- virtual std::string DebugString() const = 0; |
+ protected: |
+ static int number_active_objects_; |
}; |
} // namespace content |