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; |