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

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

Issue 8399001: Use a DownloadRequestHandle pointer in construction to allow mocking for tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compile error. Created 9 years, 2 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_item.h
diff --git a/content/browser/download/download_item.h b/content/browser/download/download_item.h
index 7a19ea014107f293a632e8e043d9a96cf8097beb..f264861213670cb8a18e265602273e0a9744db89 100644
--- a/content/browser/download/download_item.h
+++ b/content/browser/download/download_item.h
@@ -22,6 +22,7 @@
#include "base/basictypes.h"
#include "base/file_path.h"
+#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/time.h"
#include "base/timer.h"
@@ -35,6 +36,8 @@
class DownloadFileManager;
class DownloadId;
class DownloadManager;
+class TabContents;
+
struct DownloadCreateInfo;
struct DownloadPersistentStoreInfo;
@@ -116,10 +119,11 @@ class CONTENT_EXPORT DownloadItem {
DownloadItem(DownloadManager* download_manager,
const DownloadPersistentStoreInfo& info);
- // Constructing for a regular download:
+ // Constructing for a regular download.
+ // Takes ownership of the object pointed to by |request_handle|.
DownloadItem(DownloadManager* download_manager,
const DownloadCreateInfo& info,
- const DownloadRequestHandle& request_handle,
+ DownloadRequestHandleInterface* request_handle,
bool is_otr);
// Constructing for the "Save Page As..." feature:
@@ -310,9 +314,8 @@ class CONTENT_EXPORT DownloadItem {
DownloadPersistentStoreInfo GetPersistentStoreInfo() const;
DownloadStateInfo state_info() const { return state_info_; }
- const DownloadRequestHandle& request_handle() const {
- return request_handle_;
- }
+
+ TabContents* GetTabContents() const;
// Returns the final target file path for the download.
FilePath GetTargetFilePath() const;
@@ -376,7 +379,7 @@ class CONTENT_EXPORT DownloadItem {
// The handle to the request information. Used for operations outside the
// download system.
- DownloadRequestHandle request_handle_;
+ scoped_ptr<DownloadRequestHandleInterface> request_handle_;
// Download ID assigned by DownloadResourceHandler.
int32 download_id_;

Powered by Google App Engine
This is Rietveld 408576698