| Index: chrome/browser/download/download_service.cc
|
| diff --git a/chrome/browser/download/download_service.cc b/chrome/browser/download/download_service.cc
|
| index 68a4934f0f0493ff27c8522bca3abf515c5a7db6..ff30698b998496fb7bcfbef1bfda079a9f7cb92e 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"
|
| @@ -52,11 +55,17 @@ 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, hs));
|
| + }
|
| +
|
| // Include this download manager in the set monitored by the
|
| // global status updater.
|
| g_browser_process->download_status_updater()->AddManager(manager);
|
|
|
| - download_manager_created_ = true;
|
| for (std::vector<OnManagerCreatedCallback>::iterator cb =
|
| on_manager_created_callbacks_.begin();
|
| cb != on_manager_created_callbacks_.end(); ++cb) {
|
| @@ -67,6 +76,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_;
|
| }
|
| @@ -118,4 +135,5 @@ void DownloadService::Shutdown() {
|
| BrowserContext::GetDownloadManager(profile_)->Shutdown();
|
| }
|
| manager_delegate_ = NULL;
|
| + download_history_.reset();
|
| }
|
|
|