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

Unified Diff: chrome/browser/download/chrome_download_manager_delegate.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: 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: chrome/browser/download/chrome_download_manager_delegate.cc
===================================================================
--- chrome/browser/download/chrome_download_manager_delegate.cc (revision 140592)
+++ chrome/browser/download/chrome_download_manager_delegate.cc (working copy)
@@ -57,6 +57,7 @@
#include "chrome/browser/download/save_package_file_picker_chromeos.h"
#endif
+using content::BrowserContext;
using content::BrowserThread;
using content::DownloadId;
using content::DownloadItem;
@@ -104,19 +105,16 @@
: profile_(profile),
next_download_id_(0),
download_prefs_(new DownloadPrefs(profile->GetPrefs())) {
-}
-
-ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() {
-}
-
-void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) {
- download_manager_ = dm;
+ download_manager_ = BrowserContext::GetDownloadManager(profile_);
download_history_.reset(new DownloadHistory(profile_));
download_history_->Load(
base::Bind(&DownloadManager::OnPersistentStoreQueryComplete,
- base::Unretained(dm)));
+ base::Unretained(download_manager_.get())));
}
+ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() {
+}
+
void ChromeDownloadManagerDelegate::Shutdown() {
download_history_.reset();
download_prefs_.reset();
@@ -126,8 +124,8 @@
if (!profile_->IsOffTheRecord())
return DownloadId(this, next_download_id_++);
- return profile_->GetOriginalProfile()->GetDownloadManager()->delegate()->
- GetNextId();
+ return BrowserContext::GetDownloadManager(profile_->GetOriginalProfile())->
+ delegate()->GetNextId();
}
bool ChromeDownloadManagerDelegate::ShouldStartDownload(int32 download_id) {

Powered by Google App Engine
This is Rietveld 408576698