diff options
4 files changed, 33 insertions, 3 deletions
diff --git a/chromium/components/download/public/common/in_progress_download_manager.h b/chromium/components/download/public/common/in_progress_download_manager.h index aea103385da..1b695711a1d 100644 --- a/chromium/components/download/public/common/in_progress_download_manager.h +++ b/chromium/components/download/public/common/in_progress_download_manager.h @@ -147,6 +147,11 @@ class COMPONENTS_DOWNLOAD_EXPORT InProgressDownloadManager void set_delegate(Delegate* delegate) { delegate_ = delegate; } + void set_is_origin_secure_cb( + const IsOriginSecureCallback& is_origin_secure_cb) { + is_origin_secure_cb_ = is_origin_secure_cb; + } + private: void Initialize(const base::FilePath& metadata_cache_dir); diff --git a/chromium/content/browser/browser_context.cc b/chromium/content/browser/browser_context.cc index 457f63cff27..686d57c89bc 100644 --- a/chromium/content/browser/browser_context.cc +++ b/chromium/content/browser/browser_context.cc @@ -698,4 +698,9 @@ media::VideoDecodePerfHistory* BrowserContext::GetVideoDecodePerfHistory() { return decode_history; } +download::InProgressDownloadManager* +BrowserContext::RetriveInProgressDownloadManager() { + return nullptr; +} + } // namespace content diff --git a/chromium/content/browser/download/download_manager_impl.cc b/chromium/content/browser/download/download_manager_impl.cc index 1223c0c68b5..b70e30d7620 100644 --- a/chromium/content/browser/download/download_manager_impl.cc +++ b/chromium/content/browser/download/download_manager_impl.cc @@ -296,15 +296,26 @@ DownloadManagerImpl::DownloadManagerImpl(BrowserContext* browser_context) in_progress_cache_initialized_(false), browser_context_(browser_context), delegate_(nullptr), + in_progress_manager_( + browser_context_->RetriveInProgressDownloadManager()), weak_factory_(this) { DCHECK(browser_context); download::SetIOTaskRunner( BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) download::UrlDownloadHandlerFactory::Install(new UrlDownloaderFactory()); - in_progress_manager_ = std::make_unique<download::InProgressDownloadManager>( - this, IsOffTheRecord() ? base::FilePath() : browser_context_->GetPath(), - base::BindRepeating(&IsOriginSecure)); + if (!in_progress_manager_) { + in_progress_manager_ = + std::make_unique<download::InProgressDownloadManager>( + this, + IsOffTheRecord() ? base::FilePath() : browser_context_->GetPath(), + base::BindRepeating(&IsOriginSecure)); + } else { + in_progress_manager_->set_delegate(this); + in_progress_manager_->set_download_start_observer(nullptr); + in_progress_manager_->set_is_origin_secure_cb( + base::BindRepeating(&IsOriginSecure)); + } in_progress_manager_->NotifyWhenInitialized(base::BindOnce( &DownloadManagerImpl::OnInProgressDownloadManagerInitialized, weak_factory_.GetWeakPtr())); diff --git a/chromium/content/public/browser/browser_context.h b/chromium/content/public/browser/browser_context.h index 80fcb04af4d..480f0f75d27 100644 --- a/chromium/content/public/browser/browser_context.h +++ b/chromium/content/public/browser/browser_context.h @@ -33,6 +33,10 @@ namespace base { class FilePath; } +namespace download { +class InProgressDownloadManager; +} + namespace service_manager { class Connector; } @@ -330,6 +334,11 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { // directly, so privacy is not compromised. virtual media::VideoDecodePerfHistory* GetVideoDecodePerfHistory(); + // Retrieves the InProgressDownloadManager associated with this object if + // available + virtual download::InProgressDownloadManager* + RetriveInProgressDownloadManager(); + #if defined(TOOLKIT_QT) && BUILDFLAG(ENABLE_SPELLCHECK) // Inform about not working dictionary for given language virtual void FailedToLoadDictionary(const std::string& language) = 0; |