Chromium Code Reviews| 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..9ce3068c6375efb728d9feca35e0df7885b05cc0 100644 |
| --- a/chrome/browser/download/download_service.cc |
| +++ b/chrome/browser/download/download_service.cc |
| @@ -10,13 +10,25 @@ |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "content/browser/download/download_manager.h" |
| +#include "content/browser/download/download_id_factory.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(), |
| + GetDownloadIdFactory(), |
|
Randy Smith (Not in Mondays)
2011/10/27 18:01:44
nit, suggestion: When they're equally brief with t
benjhayden
2011/10/27 19:04:41
Done.
|
| + g_browser_process->download_status_updater()); |
| manager_->Init(profile_); |
| manager_delegate_->SetDownloadManager(manager_); |
| download_manager_created_ = true; |