Index: chrome/browser/download/download_service.cc |
=================================================================== |
--- chrome/browser/download/download_service.cc (revision 108294) |
+++ chrome/browser/download/download_service.cc (working copy) |
@@ -6,15 +6,28 @@ |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/download/chrome_download_manager_delegate.h" |
+#include "chrome/browser/download/download_service_factory.h" |
#include "chrome/browser/profiles/profile.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 |
@@ -22,7 +35,9 @@ |
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; |