Commit fa9bdfac authored by Kunihiko Sakamoto's avatar Kunihiko Sakamoto Committed by Commit Bot

Rename WebPackageLoader to SignedExchangeLoader

To clarify that it is for single Signed Exchange.

Bug: 803774
Change-Id: I9a7acc5b3c7b1074828c0560fba819ae351d6ff7
Reviewed-on: https://chromium-review.googlesource.com/1100658Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kunihiko Sakamoto <ksakamoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567535}
parent 7b4dab1e
...@@ -1737,6 +1737,8 @@ jumbo_source_set("browser") { ...@@ -1737,6 +1737,8 @@ jumbo_source_set("browser") {
"web_package/signed_exchange_error.h", "web_package/signed_exchange_error.h",
"web_package/signed_exchange_handler.cc", "web_package/signed_exchange_handler.cc",
"web_package/signed_exchange_handler.h", "web_package/signed_exchange_handler.h",
"web_package/signed_exchange_loader.cc",
"web_package/signed_exchange_loader.h",
"web_package/signed_exchange_prologue.cc", "web_package/signed_exchange_prologue.cc",
"web_package/signed_exchange_prologue.h", "web_package/signed_exchange_prologue.h",
"web_package/signed_exchange_signature_header_field.cc", "web_package/signed_exchange_signature_header_field.cc",
...@@ -1749,8 +1751,6 @@ jumbo_source_set("browser") { ...@@ -1749,8 +1751,6 @@ jumbo_source_set("browser") {
"web_package/signed_exchange_utils.h", "web_package/signed_exchange_utils.h",
"web_package/web_package_context_impl.cc", "web_package/web_package_context_impl.cc",
"web_package/web_package_context_impl.h", "web_package/web_package_context_impl.h",
"web_package/web_package_loader.cc",
"web_package/web_package_loader.h",
"web_package/web_package_prefetch_handler.cc", "web_package/web_package_prefetch_handler.cc",
"web_package/web_package_prefetch_handler.h", "web_package/web_package_prefetch_handler.h",
"web_package/web_package_request_handler.cc", "web_package/web_package_request_handler.cc",
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "content/browser/loader/prefetch_url_loader_service.h" #include "content/browser/loader/prefetch_url_loader_service.h"
#include "content/browser/storage_partition_impl.h" #include "content/browser/storage_partition_impl.h"
#include "content/browser/web_package/mock_signed_exchange_handler.h" #include "content/browser/web_package/mock_signed_exchange_handler.h"
#include "content/browser/web_package/web_package_loader.h" #include "content/browser/web_package/signed_exchange_loader.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h" #include "content/public/common/content_features.h"
...@@ -40,10 +40,10 @@ struct PrefetchBrowserTestParam { ...@@ -40,10 +40,10 @@ struct PrefetchBrowserTestParam {
struct ScopedSignedExchangeHandlerFactory { struct ScopedSignedExchangeHandlerFactory {
explicit ScopedSignedExchangeHandlerFactory( explicit ScopedSignedExchangeHandlerFactory(
SignedExchangeHandlerFactory* factory) { SignedExchangeHandlerFactory* factory) {
WebPackageLoader::SetSignedExchangeHandlerFactoryForTest(factory); SignedExchangeLoader::SetSignedExchangeHandlerFactoryForTest(factory);
} }
~ScopedSignedExchangeHandlerFactory() { ~ScopedSignedExchangeHandlerFactory() {
WebPackageLoader::SetSignedExchangeHandlerFactoryForTest(nullptr); SignedExchangeLoader::SetSignedExchangeHandlerFactoryForTest(nullptr);
} }
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/browser/web_package/web_package_loader.h" #include "content/browser/web_package/signed_exchange_loader.h"
#include <memory> #include <memory>
...@@ -45,7 +45,7 @@ SignedExchangeHandlerFactory* g_signed_exchange_factory_for_testing_ = nullptr; ...@@ -45,7 +45,7 @@ SignedExchangeHandlerFactory* g_signed_exchange_factory_for_testing_ = nullptr;
} // namespace } // namespace
class WebPackageLoader::ResponseTimingInfo { class SignedExchangeLoader::ResponseTimingInfo {
public: public:
explicit ResponseTimingInfo(const network::ResourceResponseHead& response) explicit ResponseTimingInfo(const network::ResourceResponseHead& response)
: request_start_(response.request_start), : request_start_(response.request_start),
...@@ -79,7 +79,7 @@ class WebPackageLoader::ResponseTimingInfo { ...@@ -79,7 +79,7 @@ class WebPackageLoader::ResponseTimingInfo {
DISALLOW_COPY_AND_ASSIGN(ResponseTimingInfo); DISALLOW_COPY_AND_ASSIGN(ResponseTimingInfo);
}; };
WebPackageLoader::WebPackageLoader( SignedExchangeLoader::SignedExchangeLoader(
const GURL& outer_request_url, const GURL& outer_request_url,
const network::ResourceResponseHead& outer_response, const network::ResourceResponseHead& outer_response,
network::mojom::URLLoaderClientPtr forwarding_client, network::mojom::URLLoaderClientPtr forwarding_client,
...@@ -170,43 +170,44 @@ WebPackageLoader::WebPackageLoader( ...@@ -170,43 +170,44 @@ WebPackageLoader::WebPackageLoader(
pending_client_request_ = mojo::MakeRequest(&client_); pending_client_request_ = mojo::MakeRequest(&client_);
} }
WebPackageLoader::~WebPackageLoader() = default; SignedExchangeLoader::~SignedExchangeLoader() = default;
void WebPackageLoader::OnReceiveResponse( void SignedExchangeLoader::OnReceiveResponse(
const network::ResourceResponseHead& response_head) { const network::ResourceResponseHead& response_head) {
// Must not be called because this WebPackageLoader and the client endpoints // Must not be called because this SignedExchangeLoader and the client
// were bound after OnReceiveResponse() is called. // endpoints were bound after OnReceiveResponse() is called.
NOTREACHED(); NOTREACHED();
} }
void WebPackageLoader::OnReceiveRedirect( void SignedExchangeLoader::OnReceiveRedirect(
const net::RedirectInfo& redirect_info, const net::RedirectInfo& redirect_info,
const network::ResourceResponseHead& response_head) { const network::ResourceResponseHead& response_head) {
// Must not be called because this WebPackageLoader and the client endpoints // Must not be called because this SignedExchangeLoader and the client
// were bound after OnReceiveResponse() is called. // endpoints were bound after OnReceiveResponse() is called.
NOTREACHED(); NOTREACHED();
} }
void WebPackageLoader::OnUploadProgress(int64_t current_position, void SignedExchangeLoader::OnUploadProgress(
int64_t total_size, int64_t current_position,
OnUploadProgressCallback ack_callback) { int64_t total_size,
// Must not be called because this WebPackageLoader and the client endpoints OnUploadProgressCallback ack_callback) {
// were bound after OnReceiveResponse() is called. // Must not be called because this SignedExchangeLoader and the client
// endpoints were bound after OnReceiveResponse() is called.
NOTREACHED(); NOTREACHED();
} }
void WebPackageLoader::OnReceiveCachedMetadata( void SignedExchangeLoader::OnReceiveCachedMetadata(
const std::vector<uint8_t>& data) { const std::vector<uint8_t>& data) {
// Curerntly CachedMetadata for WebPackage is not supported. // Curerntly CachedMetadata for Signed Exchange is not supported.
NOTREACHED(); NOTREACHED();
} }
void WebPackageLoader::OnTransferSizeUpdated(int32_t transfer_size_diff) { void SignedExchangeLoader::OnTransferSizeUpdated(int32_t transfer_size_diff) {
// TODO(https://crbug.com/803774): Implement this to progressively update the // TODO(https://crbug.com/803774): Implement this to progressively update the
// encoded data length in DevTools. // encoded data length in DevTools.
} }
void WebPackageLoader::OnStartLoadingResponseBody( void SignedExchangeLoader::OnStartLoadingResponseBody(
mojo::ScopedDataPipeConsumerHandle body) { mojo::ScopedDataPipeConsumerHandle body) {
auto cert_fetcher_factory = SignedExchangeCertFetcherFactory::Create( auto cert_fetcher_factory = SignedExchangeCertFetcherFactory::Create(
std::move(request_initiator_), std::move(url_loader_factory_), std::move(request_initiator_), std::move(url_loader_factory_),
...@@ -215,7 +216,7 @@ void WebPackageLoader::OnStartLoadingResponseBody( ...@@ -215,7 +216,7 @@ void WebPackageLoader::OnStartLoadingResponseBody(
if (g_signed_exchange_factory_for_testing_) { if (g_signed_exchange_factory_for_testing_) {
signed_exchange_handler_ = g_signed_exchange_factory_for_testing_->Create( signed_exchange_handler_ = g_signed_exchange_factory_for_testing_->Create(
std::make_unique<DataPipeToSourceStream>(std::move(body)), std::make_unique<DataPipeToSourceStream>(std::move(body)),
base::BindOnce(&WebPackageLoader::OnHTTPExchangeFound, base::BindOnce(&SignedExchangeLoader::OnHTTPExchangeFound,
weak_factory_.GetWeakPtr()), weak_factory_.GetWeakPtr()),
std::move(cert_fetcher_factory)); std::move(cert_fetcher_factory));
return; return;
...@@ -223,23 +224,23 @@ void WebPackageLoader::OnStartLoadingResponseBody( ...@@ -223,23 +224,23 @@ void WebPackageLoader::OnStartLoadingResponseBody(
signed_exchange_handler_ = std::make_unique<SignedExchangeHandler>( signed_exchange_handler_ = std::make_unique<SignedExchangeHandler>(
content_type_, std::make_unique<DataPipeToSourceStream>(std::move(body)), content_type_, std::make_unique<DataPipeToSourceStream>(std::move(body)),
base::BindOnce(&WebPackageLoader::OnHTTPExchangeFound, base::BindOnce(&SignedExchangeLoader::OnHTTPExchangeFound,
weak_factory_.GetWeakPtr()), weak_factory_.GetWeakPtr()),
std::move(cert_fetcher_factory), load_flags_, std::move(cert_fetcher_factory), load_flags_,
std::move(request_context_getter_), std::move(devtools_proxy_)); std::move(request_context_getter_), std::move(devtools_proxy_));
} }
void WebPackageLoader::OnComplete( void SignedExchangeLoader::OnComplete(
const network::URLLoaderCompletionStatus& status) {} const network::URLLoaderCompletionStatus& status) {}
void WebPackageLoader::FollowRedirect( void SignedExchangeLoader::FollowRedirect(
const base::Optional<std::vector<std::string>>& const base::Optional<std::vector<std::string>>&
to_be_removed_request_headers, to_be_removed_request_headers,
const base::Optional<net::HttpRequestHeaders>& modified_request_headers) { const base::Optional<net::HttpRequestHeaders>& modified_request_headers) {
NOTREACHED(); NOTREACHED();
} }
void WebPackageLoader::ProceedWithResponse() { void SignedExchangeLoader::ProceedWithResponse() {
// TODO(https://crbug.com/791049): Remove this when NetworkService is // TODO(https://crbug.com/791049): Remove this when NetworkService is
// enabled by default. // enabled by default.
DCHECK(!base::FeatureList::IsEnabled(network::features::kNetworkService)); DCHECK(!base::FeatureList::IsEnabled(network::features::kNetworkService));
...@@ -250,27 +251,27 @@ void WebPackageLoader::ProceedWithResponse() { ...@@ -250,27 +251,27 @@ void WebPackageLoader::ProceedWithResponse() {
client_->OnStartLoadingResponseBody(std::move(pending_body_consumer_)); client_->OnStartLoadingResponseBody(std::move(pending_body_consumer_));
} }
void WebPackageLoader::SetPriority(net::RequestPriority priority, void SignedExchangeLoader::SetPriority(net::RequestPriority priority,
int intra_priority_value) { int intra_priority_value) {
// TODO(https://crbug.com/803774): Implement this. // TODO(https://crbug.com/803774): Implement this.
} }
void WebPackageLoader::PauseReadingBodyFromNet() { void SignedExchangeLoader::PauseReadingBodyFromNet() {
// TODO(https://crbug.com/803774): Implement this. // TODO(https://crbug.com/803774): Implement this.
} }
void WebPackageLoader::ResumeReadingBodyFromNet() { void SignedExchangeLoader::ResumeReadingBodyFromNet() {
// TODO(https://crbug.com/803774): Implement this. // TODO(https://crbug.com/803774): Implement this.
} }
void WebPackageLoader::ConnectToClient( void SignedExchangeLoader::ConnectToClient(
network::mojom::URLLoaderClientPtr client) { network::mojom::URLLoaderClientPtr client) {
DCHECK(pending_client_request_.is_pending()); DCHECK(pending_client_request_.is_pending());
mojo::FuseInterface(std::move(pending_client_request_), mojo::FuseInterface(std::move(pending_client_request_),
client.PassInterface()); client.PassInterface());
} }
void WebPackageLoader::OnHTTPExchangeFound( void SignedExchangeLoader::OnHTTPExchangeFound(
net::Error error, net::Error error,
const GURL& request_url, const GURL& request_url,
const std::string& request_method, const std::string& request_method,
...@@ -316,7 +317,7 @@ void WebPackageLoader::OnHTTPExchangeFound( ...@@ -316,7 +317,7 @@ void WebPackageLoader::OnHTTPExchangeFound(
body_data_pipe_adapter_ = std::make_unique<SourceStreamToDataPipe>( body_data_pipe_adapter_ = std::make_unique<SourceStreamToDataPipe>(
std::move(payload_stream), std::move(data_pipe.producer_handle), std::move(payload_stream), std::move(data_pipe.producer_handle),
base::BindOnce(&WebPackageLoader::FinishReadingBody, base::BindOnce(&SignedExchangeLoader::FinishReadingBody,
base::Unretained(this))); base::Unretained(this)));
if (url_loader_options_ & if (url_loader_options_ &
...@@ -330,7 +331,7 @@ void WebPackageLoader::OnHTTPExchangeFound( ...@@ -330,7 +331,7 @@ void WebPackageLoader::OnHTTPExchangeFound(
client_->OnStartLoadingResponseBody(std::move(pending_body_consumer_)); client_->OnStartLoadingResponseBody(std::move(pending_body_consumer_));
} }
void WebPackageLoader::FinishReadingBody(int result) { void SignedExchangeLoader::FinishReadingBody(int result) {
// TODO(https://crbug.com/803774): Fill the data length information too. // TODO(https://crbug.com/803774): Fill the data length information too.
network::URLLoaderCompletionStatus status; network::URLLoaderCompletionStatus status;
status.error_code = result; status.error_code = result;
...@@ -347,7 +348,7 @@ void WebPackageLoader::FinishReadingBody(int result) { ...@@ -347,7 +348,7 @@ void WebPackageLoader::FinishReadingBody(int result) {
client_->OnComplete(status); client_->OnComplete(status);
} }
void WebPackageLoader::SetSignedExchangeHandlerFactoryForTest( void SignedExchangeLoader::SetSignedExchangeHandlerFactoryForTest(
SignedExchangeHandlerFactory* factory) { SignedExchangeHandlerFactory* factory) {
g_signed_exchange_factory_for_testing_ = factory; g_signed_exchange_factory_for_testing_ = factory;
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_BROWSER_WEB_PACKAGE_WEB_PACKAGE_LOADER_H_ #ifndef CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_LOADER_H_
#define CONTENT_BROWSER_WEB_PACKAGE_WEB_PACKAGE_LOADER_H_ #define CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_LOADER_H_
#include "base/callback.h" #include "base/callback.h"
#include "base/optional.h" #include "base/optional.h"
...@@ -34,18 +34,18 @@ class SignedExchangeHandlerFactory; ...@@ -34,18 +34,18 @@ class SignedExchangeHandlerFactory;
class URLLoaderThrottle; class URLLoaderThrottle;
class SourceStreamToDataPipe; class SourceStreamToDataPipe;
// WebPackageLoader handles an origin-signed HTTP exchange response. It is // SignedExchangeLoader handles an origin-signed HTTP exchange response. It is
// created when a WebPackageRequestHandler recieves an origin-signed HTTP // created when a WebPackageRequestHandler recieves an origin-signed HTTP
// exchange response, and is owned by the handler until the StartLoaderCallback // exchange response, and is owned by the handler until the StartLoaderCallback
// of WebPackageRequestHandler::StartResponse is called. After that, it is // of WebPackageRequestHandler::StartResponse is called. After that, it is
// owned by the URLLoader mojo endpoint. // owned by the URLLoader mojo endpoint.
class WebPackageLoader final : public network::mojom::URLLoaderClient, class SignedExchangeLoader final : public network::mojom::URLLoaderClient,
public network::mojom::URLLoader { public network::mojom::URLLoader {
public: public:
using URLLoaderThrottlesGetter = base::RepeatingCallback< using URLLoaderThrottlesGetter = base::RepeatingCallback<
std::vector<std::unique_ptr<content::URLLoaderThrottle>>()>; std::vector<std::unique_ptr<content::URLLoaderThrottle>>()>;
WebPackageLoader( SignedExchangeLoader(
const GURL& outer_request_url, const GURL& outer_request_url,
const network::ResourceResponseHead& outer_response, const network::ResourceResponseHead& outer_response,
network::mojom::URLLoaderClientPtr forwarding_client, network::mojom::URLLoaderClientPtr forwarding_client,
...@@ -57,7 +57,7 @@ class WebPackageLoader final : public network::mojom::URLLoaderClient, ...@@ -57,7 +57,7 @@ class WebPackageLoader final : public network::mojom::URLLoaderClient,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory, scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
URLLoaderThrottlesGetter url_loader_throttles_getter, URLLoaderThrottlesGetter url_loader_throttles_getter,
scoped_refptr<net::URLRequestContextGetter> request_context_getter); scoped_refptr<net::URLRequestContextGetter> request_context_getter);
~WebPackageLoader() override; ~SignedExchangeLoader() override;
// network::mojom::URLLoaderClient implementation // network::mojom::URLLoaderClient implementation
// Only OnStartLoadingResponseBody() and OnComplete() are called. // Only OnStartLoadingResponseBody() and OnComplete() are called.
...@@ -145,11 +145,11 @@ class WebPackageLoader final : public network::mojom::URLLoaderClient, ...@@ -145,11 +145,11 @@ class WebPackageLoader final : public network::mojom::URLLoaderClient,
std::string content_type_; std::string content_type_;
base::WeakPtrFactory<WebPackageLoader> weak_factory_; base::WeakPtrFactory<SignedExchangeLoader> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(WebPackageLoader); DISALLOW_COPY_AND_ASSIGN(SignedExchangeLoader);
}; };
} // namespace content } // namespace content
#endif // CONTENT_BROWSER_WEB_PACKAGE_WEB_PACKAGE_LOADER_H_ #endif // CONTENT_BROWSER_WEB_PACKAGE_SIGNED_EXCHANGE_LOADER_H_
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include "base/callback.h" #include "base/callback.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "content/browser/web_package/signed_exchange_devtools_proxy.h" #include "content/browser/web_package/signed_exchange_devtools_proxy.h"
#include "content/browser/web_package/signed_exchange_loader.h"
#include "content/browser/web_package/signed_exchange_url_loader_factory_for_non_network_service.h" #include "content/browser/web_package/signed_exchange_url_loader_factory_for_non_network_service.h"
#include "content/browser/web_package/web_package_loader.h"
#include "content/public/common/content_features.h" #include "content/public/common/content_features.h"
#include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/bindings/strong_binding.h"
#include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_context_getter.h"
...@@ -47,7 +47,7 @@ WebPackagePrefetchHandler::WebPackagePrefetchHandler( ...@@ -47,7 +47,7 @@ WebPackagePrefetchHandler::WebPackagePrefetchHandler(
} else { } else {
url_loader_factory = std::move(network_loader_factory); url_loader_factory = std::move(network_loader_factory);
} }
web_package_loader_ = std::make_unique<WebPackageLoader>( signed_exchange_loader_ = std::make_unique<SignedExchangeLoader>(
outer_request_url, response, std::move(client), std::move(endpoints), outer_request_url, response, std::move(client), std::move(endpoints),
std::move(request_initiator), network::mojom::kURLLoadOptionNone, std::move(request_initiator), network::mojom::kURLLoadOptionNone,
load_flags, load_flags,
...@@ -63,11 +63,11 @@ WebPackagePrefetchHandler::~WebPackagePrefetchHandler() = default; ...@@ -63,11 +63,11 @@ WebPackagePrefetchHandler::~WebPackagePrefetchHandler() = default;
network::mojom::URLLoaderClientRequest network::mojom::URLLoaderClientRequest
WebPackagePrefetchHandler::FollowRedirect( WebPackagePrefetchHandler::FollowRedirect(
network::mojom::URLLoaderRequest loader_request) { network::mojom::URLLoaderRequest loader_request) {
DCHECK(web_package_loader_); DCHECK(signed_exchange_loader_);
network::mojom::URLLoaderClientPtr client; network::mojom::URLLoaderClientPtr client;
auto pending_request = mojo::MakeRequest(&client); auto pending_request = mojo::MakeRequest(&client);
web_package_loader_->ConnectToClient(std::move(client)); signed_exchange_loader_->ConnectToClient(std::move(client));
mojo::MakeStrongBinding(std::move(web_package_loader_), mojo::MakeStrongBinding(std::move(signed_exchange_loader_),
std::move(loader_request)); std::move(loader_request));
return pending_request; return pending_request;
} }
......
...@@ -22,7 +22,7 @@ namespace content { ...@@ -22,7 +22,7 @@ namespace content {
class ResourceContext; class ResourceContext;
class URLLoaderThrottle; class URLLoaderThrottle;
class WebPackageLoader; class SignedExchangeLoader;
// Attached to each PrefetchURLLoader if the prefetch is for a signed exchange. // Attached to each PrefetchURLLoader if the prefetch is for a signed exchange.
class WebPackagePrefetchHandler final : public network::mojom::URLLoaderClient { class WebPackagePrefetchHandler final : public network::mojom::URLLoaderClient {
...@@ -31,7 +31,7 @@ class WebPackagePrefetchHandler final : public network::mojom::URLLoaderClient { ...@@ -31,7 +31,7 @@ class WebPackagePrefetchHandler final : public network::mojom::URLLoaderClient {
std::vector<std::unique_ptr<content::URLLoaderThrottle>>()>; std::vector<std::unique_ptr<content::URLLoaderThrottle>>()>;
// This takes |network_loader| and |network_client| to set up the // This takes |network_loader| and |network_client| to set up the
// WebPackageLoader (so that the loader can load data from the network). // SignedExchangeLoader (so that the loader can load data from the network).
// |forwarding_client| is a pointer to the downstream client (typically who // |forwarding_client| is a pointer to the downstream client (typically who
// creates this handler). // creates this handler).
WebPackagePrefetchHandler( WebPackagePrefetchHandler(
...@@ -51,10 +51,10 @@ class WebPackagePrefetchHandler final : public network::mojom::URLLoaderClient { ...@@ -51,10 +51,10 @@ class WebPackagePrefetchHandler final : public network::mojom::URLLoaderClient {
~WebPackagePrefetchHandler() override; ~WebPackagePrefetchHandler() override;
// This connects |loader_request| to the WebPackageLoader, and returns the // This connects |loader_request| to the SignedExchangeLoader, and returns the
// pending client request to the loader. // pending client request to the loader.
// The returned client request can be bound to the downstream client so that // The returned client request can be bound to the downstream client so that
// they can start directly receiving upcalls from the WebPackageLoader. // they can start directly receiving upcalls from the SignedExchangeLoader.
// After this point |this| can be destructed. // After this point |this| can be destructed.
network::mojom::URLLoaderClientRequest FollowRedirect( network::mojom::URLLoaderClientRequest FollowRedirect(
network::mojom::URLLoaderRequest loader_request); network::mojom::URLLoaderRequest loader_request);
...@@ -75,7 +75,7 @@ class WebPackagePrefetchHandler final : public network::mojom::URLLoaderClient { ...@@ -75,7 +75,7 @@ class WebPackagePrefetchHandler final : public network::mojom::URLLoaderClient {
mojo::Binding<network::mojom::URLLoaderClient> loader_client_binding_; mojo::Binding<network::mojom::URLLoaderClient> loader_client_binding_;
std::unique_ptr<WebPackageLoader> web_package_loader_; std::unique_ptr<SignedExchangeLoader> signed_exchange_loader_;
network::mojom::URLLoaderClient* forwarding_client_; network::mojom::URLLoaderClient* forwarding_client_;
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "content/browser/web_package/signed_exchange_devtools_proxy.h" #include "content/browser/web_package/signed_exchange_devtools_proxy.h"
#include "content/browser/web_package/signed_exchange_loader.h"
#include "content/browser/web_package/signed_exchange_utils.h" #include "content/browser/web_package/signed_exchange_utils.h"
#include "content/browser/web_package/web_package_loader.h"
#include "content/common/throttling_url_loader.h" #include "content/common/throttling_url_loader.h"
#include "content/public/common/content_features.h" #include "content/public/common/content_features.h"
#include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/bindings/strong_binding.h"
...@@ -64,7 +64,7 @@ void WebPackageRequestHandler::MaybeCreateLoader( ...@@ -64,7 +64,7 @@ void WebPackageRequestHandler::MaybeCreateLoader(
// ongoing matching SignedExchangeHandler which was created by a // ongoing matching SignedExchangeHandler which was created by a
// WebPackagePrefetcher. // WebPackagePrefetcher.
if (!web_package_loader_) { if (!signed_exchange_loader_) {
std::move(callback).Run({}); std::move(callback).Run({});
return; return;
} }
...@@ -89,7 +89,7 @@ bool WebPackageRequestHandler::MaybeCreateLoaderForResponse( ...@@ -89,7 +89,7 @@ bool WebPackageRequestHandler::MaybeCreateLoaderForResponse(
// TODO(https://crbug.com/803774): Consider creating a new ThrottlingURLLoader // TODO(https://crbug.com/803774): Consider creating a new ThrottlingURLLoader
// or reusing the existing ThrottlingURLLoader by reattaching URLLoaderClient, // or reusing the existing ThrottlingURLLoader by reattaching URLLoaderClient,
// to support SafeBrowsing checking of the content of the WebPackage. // to support SafeBrowsing checking of the content of the WebPackage.
web_package_loader_ = std::make_unique<WebPackageLoader>( signed_exchange_loader_ = std::make_unique<SignedExchangeLoader>(
url_, response, std::move(client), url_loader->Unbind(), url_, response, std::move(client), url_loader->Unbind(),
std::move(request_initiator_), url_loader_options_, load_flags_, std::move(request_initiator_), url_loader_options_, load_flags_,
std::make_unique<SignedExchangeDevToolsProxy>( std::make_unique<SignedExchangeDevToolsProxy>(
...@@ -104,8 +104,9 @@ bool WebPackageRequestHandler::MaybeCreateLoaderForResponse( ...@@ -104,8 +104,9 @@ bool WebPackageRequestHandler::MaybeCreateLoaderForResponse(
void WebPackageRequestHandler::StartResponse( void WebPackageRequestHandler::StartResponse(
network::mojom::URLLoaderRequest request, network::mojom::URLLoaderRequest request,
network::mojom::URLLoaderClientPtr client) { network::mojom::URLLoaderClientPtr client) {
web_package_loader_->ConnectToClient(std::move(client)); signed_exchange_loader_->ConnectToClient(std::move(client));
mojo::MakeStrongBinding(std::move(web_package_loader_), std::move(request)); mojo::MakeStrongBinding(std::move(signed_exchange_loader_),
std::move(request));
} }
} // namespace content } // namespace content
...@@ -22,7 +22,7 @@ class SharedURLLoaderFactory; ...@@ -22,7 +22,7 @@ class SharedURLLoaderFactory;
namespace content { namespace content {
class URLLoaderThrottle; class URLLoaderThrottle;
class WebPackageLoader; class SignedExchangeLoader;
class WebPackageRequestHandler final : public NavigationLoaderInterceptor { class WebPackageRequestHandler final : public NavigationLoaderInterceptor {
public: public:
...@@ -61,7 +61,7 @@ class WebPackageRequestHandler final : public NavigationLoaderInterceptor { ...@@ -61,7 +61,7 @@ class WebPackageRequestHandler final : public NavigationLoaderInterceptor {
// Valid after MaybeCreateLoaderForResponse intercepts the request and until // Valid after MaybeCreateLoaderForResponse intercepts the request and until
// the loader is re-bound to the new client for the redirected request in // the loader is re-bound to the new client for the redirected request in
// StartResponse. // StartResponse.
std::unique_ptr<WebPackageLoader> web_package_loader_; std::unique_ptr<SignedExchangeLoader> signed_exchange_loader_;
url::Origin request_initiator_; url::Origin request_initiator_;
GURL url_; GURL url_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment