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

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

Issue 10344024: Rewrite download manager unit to be actual unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync'd to LKGR. Created 8 years, 6 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_manager_impl.h
diff --git a/content/browser/download/download_manager_impl.h b/content/browser/download/download_manager_impl.h
index 44a952892a70603089cd11d8f5479b98ef15b5f7..0f6670abc606aeefff585d1ab695d13b5779689e 100644
--- a/content/browser/download/download_manager_impl.h
+++ b/content/browser/download/download_manager_impl.h
@@ -1,7 +1,6 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-//
#ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
#define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
@@ -17,15 +16,25 @@
#include "base/message_loop_helpers.h"
#include "base/observer_list.h"
#include "base/synchronization/lock.h"
+#include "content/browser/download/download_item_factory.h"
#include "content/browser/download/download_item_impl.h"
#include "content/common/content_export.h"
#include "content/public/browser/download_manager.h"
+class DownloadFileManager;
+
class CONTENT_EXPORT DownloadManagerImpl
: public content::DownloadManager,
public DownloadItemImpl::Delegate {
public:
- explicit DownloadManagerImpl(net::NetLog* net_log);
+ // Caller guarantees that |file_manager| and |net_log| will remain valid
+ // for the lifetime of DownloadManagerImpl (until Shutdown() is called).
+ // |factory| may be a default constructed (null) scoped_ptr; if so,
+ // the DownloadManagerImpl creates and takes ownership of the
+ // default DownloadItemFactory.
+ DownloadManagerImpl(DownloadFileManager* file_manager,
+ scoped_ptr<content::DownloadItemFactory> factory,
+ net::NetLog* net_log);
// content::DownloadManager functions.
virtual void SetDelegate(content::DownloadManagerDelegate* delegate) OVERRIDE;
@@ -109,9 +118,6 @@ class CONTENT_EXPORT DownloadManagerImpl
virtual void AssertStateConsistent(
content::DownloadItem* download) const OVERRIDE;
- // For unit tests only.
- void SetFileManagerForTesting(DownloadFileManager* file_manager);
-
private:
typedef std::set<content::DownloadItem*> DownloadSet;
typedef base::hash_map<int64, content::DownloadItem*> DownloadMap;
@@ -179,6 +185,9 @@ class CONTENT_EXPORT DownloadManagerImpl
// Called when Save Page As entry is committed to the persistent store.
void OnSavePageItemAddedToPersistentStore(int32 download_id, int64 db_handle);
+ // Factory for creation of downloads items.
+ scoped_ptr<content::DownloadItemFactory> factory_;
+
// |downloads_| is the owning set for all downloads known to the
// DownloadManager. This includes downloads started by the user in
// this session, downloads initialized from the history system, and
« no previous file with comments | « content/browser/download/download_item_impl_unittest.cc ('k') | content/browser/download/download_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698