diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-03 13:42:47 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-15 10:27:51 +0000 |
commit | 8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec (patch) | |
tree | d29d987c4d7b173cf853279b79a51598f104b403 /chromium/content/browser/download/download_manager_impl.h | |
parent | 830c9e163d31a9180fadca926b3e1d7dfffb5021 (diff) | |
download | qtwebengine-chromium-8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec.tar.gz |
BASELINE: Update Chromium to 66.0.3359.156
Change-Id: I0c9831ad39911a086b6377b16f995ad75a51e441
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/content/browser/download/download_manager_impl.h')
-rw-r--r-- | chromium/content/browser/download/download_manager_impl.h | 78 |
1 files changed, 49 insertions, 29 deletions
diff --git a/chromium/content/browser/download/download_manager_impl.h b/chromium/content/browser/download/download_manager_impl.h index a4b9830a646..f9698955656 100644 --- a/chromium/content/browser/download/download_manager_impl.h +++ b/chromium/content/browser/download/download_manager_impl.h @@ -20,6 +20,7 @@ #include "base/observer_list.h" #include "base/sequenced_task_runner_helpers.h" #include "base/synchronization/lock.h" +#include "components/download/public/common/download_url_parameters.h" #include "content/browser/download/download_item_impl_delegate.h" #include "content/browser/download/url_download_handler.h" #include "content/browser/loader/navigation_url_loader.h" @@ -27,16 +28,18 @@ #include "content/public/browser/browser_thread.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/download_manager_delegate.h" -#include "content/public/browser/download_url_parameters.h" #include "content/public/browser/ssl_status.h" #include "services/metrics/public/cpp/ukm_source_id.h" -#include "services/network/public/interfaces/url_loader.mojom.h" +#include "services/network/public/mojom/url_loader.mojom.h" + +namespace download { +class DownloadRequestHandleInterface; +} namespace content { class DownloadFileFactory; class DownloadItemFactory; class DownloadItemImpl; -class DownloadRequestHandleInterface; class ResourceContext; class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, @@ -61,7 +64,9 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, const base::FilePath& main_file_path, const GURL& page_url, const std::string& mime_type, - std::unique_ptr<DownloadRequestHandleInterface> request_handle, + int render_process_id, + int render_frame_id, + std::unique_ptr<download::DownloadRequestHandleInterface> request_handle, const ukm::SourceId ukm_source_id, const DownloadItemImplCreated& item_created); @@ -70,19 +75,23 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, DownloadManagerDelegate* GetDelegate() const override; void Shutdown() override; void GetAllDownloads(DownloadVector* result) override; - void StartDownload( - std::unique_ptr<DownloadCreateInfo> info, - std::unique_ptr<DownloadManager::InputStream> stream, - const DownloadUrlParameters::OnStartedCallback& on_started) override; + void StartDownload(std::unique_ptr<download::DownloadCreateInfo> info, + std::unique_ptr<DownloadManager::InputStream> stream, + const download::DownloadUrlParameters::OnStartedCallback& + on_started) override; int RemoveDownloadsByURLAndTime( const base::Callback<bool(const GURL&)>& url_filter, base::Time remove_begin, base::Time remove_end) override; - void DownloadUrl(std::unique_ptr<DownloadUrlParameters> params) override; + void DownloadUrl( + std::unique_ptr<download::DownloadUrlParameters> parameters) override; + void DownloadUrl( + std::unique_ptr<download::DownloadUrlParameters> params, + std::unique_ptr<storage::BlobDataHandle> blob_data_handle) override; void AddObserver(Observer* observer) override; void RemoveObserver(Observer* observer) override; - content::DownloadItem* CreateDownloadItem( + download::DownloadItem* CreateDownloadItem( const std::string& guid, uint32_t id, const base::FilePath& current_path, @@ -101,27 +110,29 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, int64_t received_bytes, int64_t total_bytes, const std::string& hash, - content::DownloadItem::DownloadState state, - DownloadDangerType danger_type, - DownloadInterruptReason interrupt_reason, + download::DownloadItem::DownloadState state, + download::DownloadDangerType danger_type, + download::DownloadInterruptReason interrupt_reason, bool opened, base::Time last_access_time, bool transient, - const std::vector<DownloadItem::ReceivedSlice>& received_slices) override; + const std::vector<download::DownloadItem::ReceivedSlice>& received_slices) + override; void PostInitialization(DownloadInitializationDependency dependency) override; bool IsManagerInitialized() const override; int InProgressCount() const override; int NonMaliciousInProgressCount() const override; BrowserContext* GetBrowserContext() const override; void CheckForHistoryFilesRemoval() override; - DownloadItem* GetDownload(uint32_t id) override; - DownloadItem* GetDownloadByGuid(const std::string& guid) override; + download::DownloadItem* GetDownload(uint32_t id) override; + download::DownloadItem* GetDownloadByGuid(const std::string& guid) override; // UrlDownloadHandler::Delegate implementation. void OnUrlDownloadStarted( - std::unique_ptr<DownloadCreateInfo> download_create_info, + std::unique_ptr<download::DownloadCreateInfo> download_create_info, std::unique_ptr<DownloadManager::InputStream> stream, - const DownloadUrlParameters::OnStartedCallback& callback) override; + const download::DownloadUrlParameters::OnStartedCallback& callback) + override; void OnUrlDownloadStopped(UrlDownloadHandler* downloader) override; // For testing; specifically, accessed from TestFileErrorInjector. @@ -136,10 +147,10 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, // ResourceDispatcherHostImpl::BeginURLRequest function. The function returns // the result of the downoad operation. Please see the // DownloadInterruptReason enum for information on possible return values. - static DownloadInterruptReason BeginDownloadRequest( + static download::DownloadInterruptReason BeginDownloadRequest( std::unique_ptr<net::URLRequest> url_request, ResourceContext* resource_context, - DownloadUrlParameters* params); + download::DownloadUrlParameters* params); // Continue a navigation that ends up to be a download after it reaches the // OnResponseStarted() step. It has to be called on the UI thread. @@ -153,7 +164,7 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, int frame_tree_node_id); private: - using DownloadSet = std::set<DownloadItem*>; + using DownloadSet = std::set<download::DownloadItem*>; using DownloadGuidMap = std::unordered_map<std::string, DownloadItemImpl*>; using DownloadItemImplVector = std::vector<DownloadItemImpl*>; @@ -162,9 +173,9 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, friend class DownloadTest; void StartDownloadWithId( - std::unique_ptr<DownloadCreateInfo> info, + std::unique_ptr<download::DownloadCreateInfo> info, std::unique_ptr<DownloadManager::InputStream> stream, - const DownloadUrlParameters::OnStartedCallback& on_started, + const download::DownloadUrlParameters::OnStartedCallback& on_started, bool new_download, uint32_t id); @@ -172,15 +183,21 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, const base::FilePath& main_file_path, const GURL& page_url, const std::string& mime_type, - std::unique_ptr<DownloadRequestHandleInterface> request_handle, + int render_process_id, + int render_frame_id, + std::unique_ptr<download::DownloadRequestHandleInterface> request_handle, const ukm::SourceId ukm_source_id, const DownloadItemImplCreated& on_started, uint32_t id); + // Intercepts the download to another system if applicable. Returns true if + // the download was intercepted. + bool InterceptDownload(const download::DownloadCreateInfo& info); + // Create a new active item based on the info. Separate from // StartDownload() for testing. DownloadItemImpl* CreateActiveItem(uint32_t id, - const DownloadCreateInfo& info); + const download::DownloadCreateInfo& info); // Get next download id. |callback| is called on the UI thread and may // be called synchronously. @@ -203,7 +220,7 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, void CheckForFileRemoval(DownloadItemImpl* download_item) override; std::string GetApplicationClientIdForFileScanning() const override; void ResumeInterruptedDownload( - std::unique_ptr<content::DownloadUrlParameters> params, + std::unique_ptr<download::DownloadUrlParameters> params, uint32_t id) override; void OpenDownload(DownloadItemImpl* download) override; bool IsMostRecentDownloadItemAtFilePath(DownloadItemImpl* download) override; @@ -214,7 +231,8 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, // Helper method to start or resume a download. void BeginDownloadInternal( - std::unique_ptr<content::DownloadUrlParameters> params, + std::unique_ptr<download::DownloadUrlParameters> params, + std::unique_ptr<storage::BlobDataHandle> blob_data_handle, uint32_t id); void InterceptNavigationOnChecksComplete( @@ -232,8 +250,9 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, // regular document loader. Must be called on the IO thread. static void CreateDownloadHandlerForNavigation( base::WeakPtr<DownloadManagerImpl> download_manager, - ResourceRequestInfo::WebContentsGetter web_contents_getter, std::unique_ptr<network::ResourceRequest> resource_request, + int render_process_id, + int render_frame_id, std::vector<GURL> url_chain, const base::Optional<std::string>& suggested_filename, scoped_refptr<network::ResourceResponse> response, @@ -274,7 +293,8 @@ class CONTENT_EXPORT DownloadManagerImpl : public DownloadManager, base::ObserverList<Observer> observers_; // Stores information about in-progress download items. - std::unique_ptr<DownloadItem::Observer> in_progress_download_observer_; + std::unique_ptr<download::DownloadItem::Observer> + in_progress_download_observer_; // The current active browser context. BrowserContext* browser_context_; |