diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-24 12:15:48 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-28 13:30:04 +0000 |
commit | b014812705fc80bff0a5c120dfcef88f349816dc (patch) | |
tree | 25a2e2d9fa285f1add86aa333389a839f81a39ae /chromium/components/download/internal/common/resource_downloader.cc | |
parent | 9f4560b1027ae06fdb497023cdcaf91b8511fa74 (diff) | |
download | qtwebengine-chromium-b014812705fc80bff0a5c120dfcef88f349816dc.tar.gz |
BASELINE: Update Chromium to 68.0.3440.125
Change-Id: I23f19369e01f688e496f5bf179abb521ad73874f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/components/download/internal/common/resource_downloader.cc')
-rw-r--r-- | chromium/components/download/internal/common/resource_downloader.cc | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/chromium/components/download/internal/common/resource_downloader.cc b/chromium/components/download/internal/common/resource_downloader.cc index ab961f310e3..988cf5cef88 100644 --- a/chromium/components/download/internal/common/resource_downloader.cc +++ b/chromium/components/download/internal/common/resource_downloader.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/download/public/common/resource_downloader.h" +#include "components/download/internal/common/resource_downloader.h" #include <memory> -#include "base/strings/utf_string_conversions.h" +#include "components/download/public/common/download_url_loader_factory_getter.h" #include "components/download/public/common/stream_handle_input_stream.h" #include "services/network/public/cpp/shared_url_loader_factory.h" @@ -60,7 +60,8 @@ std::unique_ptr<ResourceDownloader> ResourceDownloader::BeginDownload( base::WeakPtr<UrlDownloadHandler::Delegate> delegate, std::unique_ptr<DownloadUrlParameters> params, std::unique_ptr<network::ResourceRequest> request, - scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory, + scoped_refptr<download::DownloadURLLoaderFactoryGetter> + url_loader_factory_getter, const GURL& site_url, const GURL& tab_url, const GURL& tab_referrer_url, @@ -71,7 +72,7 @@ std::unique_ptr<ResourceDownloader> ResourceDownloader::BeginDownload( delegate, std::move(request), params->render_process_host_id(), params->render_frame_host_routing_id(), site_url, tab_url, tab_referrer_url, download_id, task_runner, - std::move(shared_url_loader_factory)); + std::move(url_loader_factory_getter)); downloader->Start(std::move(params), is_parallel_request); return downloader; @@ -88,18 +89,18 @@ ResourceDownloader::InterceptNavigationResponse( const GURL& tab_url, const GURL& tab_referrer_url, std::vector<GURL> url_chain, - const base::Optional<std::string>& suggested_filename, const scoped_refptr<network::ResourceResponse>& response, net::CertStatus cert_status, network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints, - scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory, + scoped_refptr<download::DownloadURLLoaderFactoryGetter> + url_loader_factory_getter, const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { auto downloader = std::make_unique<ResourceDownloader>( delegate, std::move(resource_request), render_process_id, render_frame_id, site_url, tab_url, tab_referrer_url, download::DownloadItem::kInvalidId, - task_runner, std::move(shared_url_loader_factory)); + task_runner, std::move(url_loader_factory_getter)); downloader->InterceptResponse(std::move(response), std::move(url_chain), - suggested_filename, cert_status, + cert_status, std::move(url_loader_client_endpoints)); return downloader; } @@ -114,7 +115,8 @@ ResourceDownloader::ResourceDownloader( const GURL& tab_referrer_url, uint32_t download_id, const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, - scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory) + scoped_refptr<download::DownloadURLLoaderFactoryGetter> + url_loader_factory_getter) : delegate_(delegate), resource_request_(std::move(resource_request)), download_id_(download_id), @@ -124,7 +126,7 @@ ResourceDownloader::ResourceDownloader( tab_url_(tab_url), tab_referrer_url_(tab_referrer_url), delegate_task_runner_(task_runner), - shared_url_loader_factory_(std::move(shared_url_loader_factory)), + url_loader_factory_getter_(std::move(url_loader_factory_getter)), weak_ptr_factory_(this) {} ResourceDownloader::~ResourceDownloader() = default; @@ -154,7 +156,7 @@ void ResourceDownloader::Start( // Set up the URLLoader network::mojom::URLLoaderRequest url_loader_request = mojo::MakeRequest(&url_loader_); - shared_url_loader_factory_->CreateLoaderAndStart( + url_loader_factory_getter_->GetURLLoaderFactory()->CreateLoaderAndStart( std::move(url_loader_request), 0, // routing_id 0, // request_id @@ -169,18 +171,14 @@ void ResourceDownloader::Start( void ResourceDownloader::InterceptResponse( const scoped_refptr<network::ResourceResponse>& response, std::vector<GURL> url_chain, - const base::Optional<std::string>& suggested_filename, net::CertStatus cert_status, network::mojom::URLLoaderClientEndpointsPtr endpoints) { // Set the URLLoader. url_loader_.Bind(std::move(endpoints->url_loader)); // Create the new URLLoaderClient that will intercept the navigation. - auto save_info = std::make_unique<DownloadSaveInfo>(); - if (suggested_filename.has_value()) - save_info->suggested_name = base::UTF8ToUTF16(suggested_filename.value()); url_loader_client_ = std::make_unique<DownloadResponseHandler>( - resource_request_.get(), this, std::move(save_info), + resource_request_.get(), this, std::make_unique<DownloadSaveInfo>(), false, /* is_parallel_request */ false, /* is_transient */ false, /* fetch_error_body */ @@ -216,11 +214,11 @@ void ResourceDownloader::OnResponseStarted( &UrlDownloadHandler::Delegate::OnUrlDownloadStarted, delegate_, std::move(download_create_info), std::make_unique<StreamHandleInputStream>(std::move(stream_handle)), - std::move(shared_url_loader_factory_), callback_)); + std::move(url_loader_factory_getter_), callback_)); } void ResourceDownloader::OnReceiveRedirect() { - url_loader_->FollowRedirect(); + url_loader_->FollowRedirect(base::nullopt); } } // namespace download |