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

Unified Diff: chrome/browser/download/download_service.cc

Issue 8401001: Fix history importing by delaying DownloadManager creation. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix ifndefs 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/download/download_service.h ('k') | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_service.cc
diff --git a/chrome/browser/download/download_service.cc b/chrome/browser/download/download_service.cc
index 6b5fcb26bfaa7bab5b1133a4a672bae07c52b400..c5263be1da220a727c7cadd2a922e687e8a20c7d 100644
--- a/chrome/browser/download/download_service.cc
+++ b/chrome/browser/download/download_service.cc
@@ -9,14 +9,26 @@
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "content/browser/download/download_id_factory.h"
#include "content/browser/download/download_manager.h"
DownloadService::DownloadService(Profile* profile)
: download_manager_created_(false),
- profile_(profile) {}
+ profile_(profile) {
+ if (profile_->IsOffTheRecord()) {
+ id_factory_ = DownloadServiceFactory::GetForProfile(
+ profile_->GetOriginalProfile())->GetDownloadIdFactory();
+ } else {
+ id_factory_ = new DownloadIdFactory(this);
+ }
+}
DownloadService::~DownloadService() {}
+DownloadIdFactory* DownloadService::GetDownloadIdFactory() const {
+ return id_factory_.get();
+}
+
DownloadManager* DownloadService::GetDownloadManager() {
if (!download_manager_created_) {
// In case the delegate has already been set by
@@ -24,7 +36,9 @@ DownloadManager* DownloadService::GetDownloadManager() {
if (!manager_delegate_.get())
manager_delegate_ = new ChromeDownloadManagerDelegate(profile_);
manager_ = new DownloadManager(
- manager_delegate_.get(), g_browser_process->download_status_updater());
+ manager_delegate_.get(),
+ id_factory_.get(),
+ g_browser_process->download_status_updater());
manager_->Init(profile_);
manager_delegate_->SetDownloadManager(manager_);
download_manager_created_ = true;
« no previous file with comments | « chrome/browser/download/download_service.h ('k') | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698