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

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

Issue 10535026: Move creation and ownership of DownloadManager from the embedder to content. This matches all the o… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix cros compile 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.cc
===================================================================
--- content/browser/download/download_manager_impl.cc (revision 140592)
+++ content/browser/download/download_manager_impl.cc (working copy)
@@ -140,13 +140,6 @@
namespace content {
-// static
-DownloadManager* DownloadManager::Create(
- content::DownloadManagerDelegate* delegate,
- net::NetLog* net_log) {
- return new DownloadManagerImpl(delegate, net_log);
-}
-
bool DownloadManager::EnsureNoPendingDownloadsForTesting() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
bool result = true;
@@ -159,14 +152,12 @@
} // namespace content
-DownloadManagerImpl::DownloadManagerImpl(
- content::DownloadManagerDelegate* delegate,
- net::NetLog* net_log)
- : shutdown_needed_(false),
- browser_context_(NULL),
- file_manager_(NULL),
- delegate_(delegate),
- net_log_(net_log) {
+DownloadManagerImpl::DownloadManagerImpl(net::NetLog* net_log)
+ : shutdown_needed_(false),
+ browser_context_(NULL),
+ file_manager_(NULL),
+ delegate_(NULL),
+ net_log_(net_log) {
}
DownloadManagerImpl::~DownloadManagerImpl() {
@@ -185,6 +176,11 @@
return delegate_->ShouldOpenFileBasedOnExtension(path);
}
+void DownloadManagerImpl::SetDelegate(
+ content::DownloadManagerDelegate* delegate) {
+ delegate_ = delegate;
+}
+
void DownloadManagerImpl::Shutdown() {
VLOG(20) << __FUNCTION__ << "()"
<< " shutdown_needed_ = " << shutdown_needed_;
@@ -249,7 +245,8 @@
DCHECK(save_page_downloads_.empty());
file_manager_ = NULL;
- delegate_->Shutdown();
+ if (delegate_)
+ delegate_->Shutdown();
}
void DownloadManagerImpl::GetTemporaryDownloads(

Powered by Google App Engine
This is Rietveld 408576698