#include "content/browser/loader/keep_alive_url_loader_service.h"
#include <map>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/trace_event/typed_macros.h"
#include "content/browser/attribution_reporting/attribution_suitable_context.h"
#include "content/browser/loader/keep_alive_attribution_request_helper.h"
#include "content/browser/loader/keep_alive_url_loader.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/policy_container_host.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/url_loader_throttles.h"
#include "content/public/browser/web_contents.h"
#include "mojo/public/cpp/bindings/associated_receiver_set.h"
#include "mojo/public/cpp/bindings/message.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "third_party/blink/public/common/features.h"
namespace content {
KeepAliveURLLoaderService::FactoryContext::FactoryContext(
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory,
scoped_refptr<PolicyContainerHost> frame_policy_container_host)
: … { … }
KeepAliveURLLoaderService::FactoryContext::FactoryContext(
const std::unique_ptr<FactoryContext>& other)
: … { … }
KeepAliveURLLoaderService::FactoryContext::~FactoryContext() = default;
void KeepAliveURLLoaderService::FactoryContext::OnDidCommitNavigation(
WeakDocumentPtr committed_document) { … }
void KeepAliveURLLoaderService::FactoryContext::UpdateFactory(
scoped_refptr<network::SharedURLLoaderFactory> new_factory) { … }
template <typename Interface,
template <typename>
class PendingReceiverType,
template <typename, typename>
class ReceiverSetType>
class KeepAliveURLLoaderService::KeepAliveURLLoaderFactoriesBase { … };
class KeepAliveURLLoaderService::KeepAliveURLLoaderFactories final
: public KeepAliveURLLoaderService::KeepAliveURLLoaderFactoriesBase<
network::mojom::URLLoader,
mojo::PendingReceiver,
mojo::ReceiverSet>,
public network::mojom::URLLoaderFactory { … };
class KeepAliveURLLoaderService::FetchLaterLoaderFactories final
: public KeepAliveURLLoaderService::KeepAliveURLLoaderFactoriesBase<
blink::mojom::FetchLaterLoader,
mojo::PendingAssociatedReceiver,
mojo::AssociatedReceiverSet>,
public blink::mojom::FetchLaterLoaderFactory { … };
KeepAliveURLLoaderService::KeepAliveURLLoaderService(
BrowserContext* browser_context)
: … { … }
KeepAliveURLLoaderService::~KeepAliveURLLoaderService() = default;
base::WeakPtr<KeepAliveURLLoaderService::FactoryContext>
KeepAliveURLLoaderService::BindFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver,
scoped_refptr<network::SharedURLLoaderFactory>
subresource_proxying_factory_bundle,
scoped_refptr<PolicyContainerHost> policy_container_host) { … }
base::WeakPtr<KeepAliveURLLoaderService::FactoryContext>
KeepAliveURLLoaderService::BindFetchLaterLoaderFactory(
mojo::PendingAssociatedReceiver<blink::mojom::FetchLaterLoaderFactory>
receiver,
scoped_refptr<network::SharedURLLoaderFactory>
subresource_proxying_factory_bundle,
scoped_refptr<PolicyContainerHost> policy_container_host) { … }
void KeepAliveURLLoaderService::Shutdown() { … }
size_t KeepAliveURLLoaderService::NumLoadersForTesting() const { … }
size_t KeepAliveURLLoaderService::NumDisconnectedLoadersForTesting() const { … }
void KeepAliveURLLoaderService::SetLoaderObserverForTesting(
scoped_refptr<KeepAliveURLLoader::TestObserver> observer) { … }
void KeepAliveURLLoaderService::SetURLLoaderThrottlesGetterForTesting(
KeepAliveURLLoader::URLLoaderThrottlesGetter
url_loader_throttles_getter_for_testing) { … }
}