#include "third_party/blink/public/platform/child_url_loader_factory_bundle.h"
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "base/check.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "net/base/load_flags.h"
#include "services/network/public/cpp/record_ontransfersizeupdate_utils.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/early_hints.mojom.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
#include "third_party/blink/renderer/platform/loader/fetch/fetch_utils.h"
#include "url/gurl.h"
#include "url/origin.h"
#include "url/url_constants.h"
namespace blink {
namespace {
class URLLoaderRelay : public network::mojom::URLLoaderClient,
public network::mojom::URLLoader { … };
template <typename TKey>
static std::map<TKey, mojo::PendingRemote<network::mojom::URLLoaderFactory>>
BoundRemoteMapToPendingRemoteMap(
std::map<TKey, mojo::Remote<network::mojom::URLLoaderFactory>> input) { … }
}
ChildPendingURLLoaderFactoryBundle::ChildPendingURLLoaderFactoryBundle() =
default;
ChildPendingURLLoaderFactoryBundle::ChildPendingURLLoaderFactoryBundle(
std::unique_ptr<PendingURLLoaderFactoryBundle> base_factories)
: … { … }
ChildPendingURLLoaderFactoryBundle::ChildPendingURLLoaderFactoryBundle(
mojo::PendingRemote<network::mojom::URLLoaderFactory>
pending_default_factory,
SchemeMap pending_scheme_specific_factories,
OriginMap pending_isolated_world_factories,
mojo::PendingRemote<network::mojom::URLLoaderFactory>
pending_subresource_proxying_loader_factory,
mojo::PendingRemote<network::mojom::URLLoaderFactory>
pending_keep_alive_loader_factory,
mojo::PendingAssociatedRemote<blink::mojom::FetchLaterLoaderFactory>
pending_fetch_later_loader_factory,
bool bypass_redirect_checks)
: … { … }
ChildPendingURLLoaderFactoryBundle::~ChildPendingURLLoaderFactoryBundle() =
default;
scoped_refptr<network::SharedURLLoaderFactory>
ChildPendingURLLoaderFactoryBundle::CreateFactory() { … }
ChildURLLoaderFactoryBundle::ChildURLLoaderFactoryBundle() = default;
ChildURLLoaderFactoryBundle::ChildURLLoaderFactoryBundle(
std::unique_ptr<ChildPendingURLLoaderFactoryBundle> pending_factories) { … }
ChildURLLoaderFactoryBundle::~ChildURLLoaderFactoryBundle() = default;
void ChildURLLoaderFactoryBundle::CreateLoaderAndStart(
mojo::PendingReceiver<network::mojom::URLLoader> loader,
int32_t request_id,
uint32_t options,
const network::ResourceRequest& request,
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { … }
std::unique_ptr<network::PendingSharedURLLoaderFactory>
ChildURLLoaderFactoryBundle::Clone() { … }
std::unique_ptr<ChildPendingURLLoaderFactoryBundle>
ChildURLLoaderFactoryBundle::PassInterface() { … }
void ChildURLLoaderFactoryBundle::Update(
std::unique_ptr<ChildPendingURLLoaderFactoryBundle> pending_factories) { … }
void ChildURLLoaderFactoryBundle::UpdateSubresourceOverrides(
std::vector<blink::mojom::TransferrableURLLoaderPtr>*
subresource_overrides) { … }
void ChildURLLoaderFactoryBundle::SetSubresourceProxyingLoaderFactory(
mojo::PendingRemote<network::mojom::URLLoaderFactory>
subresource_proxying_loader_factory) { … }
void ChildURLLoaderFactoryBundle::SetKeepAliveLoaderFactory(
mojo::PendingRemote<network::mojom::URLLoaderFactory>
keep_alive_loader_factory) { … }
void ChildURLLoaderFactoryBundle::SetFetchLaterLoaderFactory(
mojo::PendingAssociatedRemote<blink::mojom::FetchLaterLoaderFactory>
fetch_later_loader_factory) { … }
void ChildURLLoaderFactoryBundle::CreateFetchLaterLoader(
blink::CrossVariantMojoAssociatedReceiver<
mojom::FetchLaterLoaderInterfaceBase> loader,
int32_t request_id,
uint32_t options,
const network::ResourceRequest& request,
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { … }
bool ChildURLLoaderFactoryBundle::IsHostChildURLLoaderFactoryBundle() const { … }
}