diff options
Diffstat (limited to 'chrome/browser/download/download_service.cc')
-rw-r--r-- | chrome/browser/download/download_service.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/browser/download/download_service.cc b/chrome/browser/download/download_service.cc index 75d2877..dae3bc4 100644 --- a/chrome/browser/download/download_service.cc +++ b/chrome/browser/download/download_service.cc @@ -7,8 +7,11 @@ #include "base/callback.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/download/chrome_download_manager_delegate.h" +#include "chrome/browser/download/download_history.h" #include "chrome/browser/download/download_service_factory.h" #include "chrome/browser/download/download_status_updater.h" +#include "chrome/browser/history/history.h" +#include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/net/chrome_net_log.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" @@ -42,6 +45,16 @@ ChromeDownloadManagerDelegate* DownloadService::GetDownloadManagerDelegate() { manager_delegate_->SetDownloadManager(manager); + if (!profile_->IsOffTheRecord()) { + HistoryService* hs = HistoryServiceFactory::GetForProfile( + profile_, Profile::EXPLICIT_ACCESS); + if (hs) + download_history_.reset(new DownloadHistory( + manager, + scoped_ptr<DownloadHistory::HistoryAdapter>( + new DownloadHistory::HistoryAdapter(hs)))); + } + // Include this download manager in the set monitored by the // global status updater. g_browser_process->download_status_updater()->AddManager(manager); @@ -49,6 +62,14 @@ ChromeDownloadManagerDelegate* DownloadService::GetDownloadManagerDelegate() { return manager_delegate_.get(); } +DownloadHistory* DownloadService::GetDownloadHistory() { + if (!download_manager_created_) { + GetDownloadManagerDelegate(); + } + DCHECK(download_manager_created_); + return download_history_.get(); +} + bool DownloadService::HasCreatedDownloadManager() { return download_manager_created_; } @@ -100,4 +121,5 @@ void DownloadService::Shutdown() { BrowserContext::GetDownloadManager(profile_)->Shutdown(); } manager_delegate_ = NULL; + download_history_.reset(); } |