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

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

Issue 10799005: Replace the DownloadFileManager with direct ownership (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to LKGR. Created 8 years, 5 months 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
Index: content/browser/download/download_file.h
diff --git a/content/browser/download/download_file.h b/content/browser/download/download_file.h
index e707a26ca10607149db7f8e14d587451e6d20cb8..6ac8d19039c9353d5f30092cce47d674b2f4b410 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 rename, it will be
benjhayden 2012/07/25 15:19:16 rename? I thought this was talking about Initializ
Randy Smith (Not in Mondays) 2012/07/30 01:07:23 Done.
+ // set to the reason for the failure.
+ typedef base::Callback<void(content::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
@@ -33,10 +38,9 @@ class CONTENT_EXPORT DownloadFile {
virtual ~DownloadFile() {}
- // If calculate_hash is true, sha256 hash will be calculated.
// Returns DOWNLOAD_INTERRUPT_REASON_NONE on success, or a network
// error code on failure.
- virtual 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
@@ -68,14 +72,11 @@ 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.
+ static int GetNumberOfDownloadFiles();
- virtual std::string DebugString() const = 0;
+ protected:
+ static int number_active_objects_;
benjhayden 2012/07/25 15:19:16 Could this be done more cleanly using another inte
Randy Smith (Not in Mondays) 2012/07/30 01:07:23 I'm not quite sure what you have in mind, but I'm
benjhayden 2012/08/01 18:00:18 Methods on DownloadDestinationObserver like OnInit
Randy Smith (Not in Mondays) 2012/08/03 17:32:44 We talked about this some in person, and I suspect
};
benjhayden 2012/07/25 15:19:16 DISALLOW_COPY_AND_ASSIGN while you're here?
Randy Smith (Not in Mondays) 2012/07/30 01:07:23 My inclination is to avoid DISALLOW_COPY_AND_ASSIG
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698