#include "chrome/browser/preloading/prefetch/search_prefetch/cache_alias_search_prefetch_url_loader.h"
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/task/single_thread_task_runner.h"
#include "chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_service.h"
#include "chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/storage_partition.h"
#include "net/base/load_flags.h"
#include "net/http/http_status_code.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/record_ontransfersizeupdate_utils.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/mojom/early_hints.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "url/gurl.h"
CacheAliasSearchPrefetchURLLoader::CacheAliasSearchPrefetchURLLoader(
Profile* profile,
const net::NetworkTrafficAnnotationTag& network_traffic_annotation,
const GURL& prefetch_url)
: … { … }
CacheAliasSearchPrefetchURLLoader::~CacheAliasSearchPrefetchURLLoader() { … }
SearchPrefetchURLLoader::RequestHandler
CacheAliasSearchPrefetchURLLoader::GetServingResponseHandlerFromLoader(
std::unique_ptr<CacheAliasSearchPrefetchURLLoader> loader) { … }
void CacheAliasSearchPrefetchURLLoader::SetUpForwardingClient(
std::unique_ptr<SearchPrefetchURLLoader> loader,
const network::ResourceRequest& resource_request,
mojo::PendingReceiver<network::mojom::URLLoader> receiver,
mojo::PendingRemote<network::mojom::URLLoaderClient> forwarding_client) { … }
void CacheAliasSearchPrefetchURLLoader::StartPrefetchRequest() { … }
void CacheAliasSearchPrefetchURLLoader::RestartDirect(
FallbackReason fallback_reason) { … }
void CacheAliasSearchPrefetchURLLoader::OnReceiveEarlyHints(
network::mojom::EarlyHintsPtr early_hints) { … }
void CacheAliasSearchPrefetchURLLoader::OnReceiveResponse(
network::mojom::URLResponseHeadPtr head,
mojo::ScopedDataPipeConsumerHandle body,
std::optional<mojo_base::BigBuffer> cached_metadata) { … }
void CacheAliasSearchPrefetchURLLoader::OnReceiveRedirect(
const net::RedirectInfo& redirect_info,
network::mojom::URLResponseHeadPtr head) { … }
void CacheAliasSearchPrefetchURLLoader::OnUploadProgress(
int64_t current_position,
int64_t total_size,
OnUploadProgressCallback callback) { … }
void CacheAliasSearchPrefetchURLLoader::OnTransferSizeUpdated(
int32_t transfer_size_diff) { … }
void CacheAliasSearchPrefetchURLLoader::OnComplete(
const network::URLLoaderCompletionStatus& status) { … }
void CacheAliasSearchPrefetchURLLoader::FollowRedirect(
const std::vector<std::string>& removed_headers,
const net::HttpRequestHeaders& modified_headers,
const net::HttpRequestHeaders& modified_cors_exempt_headers,
const std::optional<GURL>& new_url) { … }
void CacheAliasSearchPrefetchURLLoader::SetPriority(
net::RequestPriority priority,
int32_t intra_priority_value) { … }
void CacheAliasSearchPrefetchURLLoader::PauseReadingBodyFromNet() { … }
void CacheAliasSearchPrefetchURLLoader::ResumeReadingBodyFromNet() { … }
void CacheAliasSearchPrefetchURLLoader::MojoDisconnectForPrefetch() { … }
void CacheAliasSearchPrefetchURLLoader::MojoDisconnectWithNoFallback() { … }