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

Unified Diff: chrome/browser/profiles/off_the_record_profile_impl.cc

Issue 8135017: Refactor downloads into a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated latest rounds of comments from John. 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
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.h ('k') | chrome/browser/profiles/profile.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/off_the_record_profile_impl.cc
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc
index 20d1c1103d4dd7e25a99fc24d8a1e53f74ec2736..d43d988a562372f71914c2ea645e3752ca1d9bb8 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -16,6 +16,8 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_plugin_service_filter.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
+#include "chrome/browser/download/download_service.h"
+#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/extensions/extension_info_map.h"
#include "chrome/browser/extensions/extension_message_service.h"
#include "chrome/browser/extensions/extension_pref_store.h"
@@ -45,7 +47,6 @@
#include "content/browser/appcache/chrome_appcache_service.h"
#include "content/browser/browser_thread.h"
#include "content/browser/chrome_blob_storage_context.h"
-#include "content/browser/download/download_manager.h"
#include "content/browser/file_system/browser_file_system_helper.h"
#include "content/browser/host_zoom_map.h"
#include "content/browser/in_process_webkit/webkit_context.h"
@@ -115,16 +116,6 @@ void OffTheRecordProfileImpl::Init() {
}
OffTheRecordProfileImpl::~OffTheRecordProfileImpl() {
- // Shutdown the DownloadManager here in the dtor as ProfileImpl does to
- // guarantee that it happens before the last scoped_refptr<DM> is reaped.
- // DownloadManager is lazily created, so check before accessing it.
- if (download_manager_.get()) {
- // Drop our download manager so we forget about all the downloads made
- // in incognito mode.
- download_manager_->Shutdown();
- download_manager_ = NULL;
- }
-
NotificationService::current()->Notify(
chrome::NOTIFICATION_PROFILE_DESTROYED, Source<Profile>(this),
NotificationService::NoDetails());
@@ -316,23 +307,7 @@ TemplateURLFetcher* OffTheRecordProfileImpl::GetTemplateURLFetcher() {
}
DownloadManager* OffTheRecordProfileImpl::GetDownloadManager() {
- if (!download_manager_.get()) {
- // In case the delegate has already been set by
- // SetDownloadManagerDelegate.
- if (!download_manager_delegate_.get())
- download_manager_delegate_ = new ChromeDownloadManagerDelegate(this);
- scoped_refptr<DownloadManager> dlm(
- new DownloadManager(download_manager_delegate_,
- g_browser_process->download_status_updater()));
- dlm->Init(this);
- download_manager_delegate_->SetDownloadManager(dlm);
- download_manager_.swap(dlm);
- }
- return download_manager_.get();
-}
-
-bool OffTheRecordProfileImpl::HasCreatedDownloadManager() const {
- return download_manager_.get() != NULL;
+ return DownloadServiceFactory::GetForProfile(this)->GetDownloadManager();
}
fileapi::FileSystemContext* OffTheRecordProfileImpl::GetFileSystemContext() {
@@ -601,11 +576,6 @@ void OffTheRecordProfileImpl::Observe(int type,
}
}
-void OffTheRecordProfileImpl::SetDownloadManagerDelegate(
- ChromeDownloadManagerDelegate* delegate) {
- download_manager_delegate_ = delegate;
-}
-
void OffTheRecordProfileImpl::CreateQuotaManagerAndClients() {
if (quota_manager_.get()) {
DCHECK(file_system_context_.get());
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.h ('k') | chrome/browser/profiles/profile.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698