#include "chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_url_loader_interceptor.h"
#include <cstddef>
#include <memory>
#include <tuple>
#include <utility>
#include "base/functional/callback.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/preloading/prefetch/search_prefetch/search_prefetch_url_loader.h"
#include "chrome/browser/preloading/prerender/prerender_utils.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "extensions/buildflags/buildflags.h"
#include "net/base/load_flags.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/single_request_url_loader_factory.h"
#include "services/network/public/cpp/url_loader_factory_builder.h"
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "extensions/browser/api/web_request/web_request_api.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
#endif
namespace {
SearchPrefetchService* GetSearchPrefetchService(int frame_tree_node_id) { … }
void SearchPrefetchRequestHandler(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const network::ResourceRequest& resource_request,
mojo::PendingReceiver<network::mojom::URLLoader> url_loader,
mojo::PendingRemote<network::mojom::URLLoaderClient> url_loader_client) { … }
}
SearchPrefetchURLLoaderInterceptor::SearchPrefetchURLLoaderInterceptor(
int frame_tree_node_id,
int64_t navigation_id,
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner)
: … { … }
SearchPrefetchURLLoaderInterceptor::~SearchPrefetchURLLoaderInterceptor() =
default;
SearchPrefetchURLLoader::RequestHandler
SearchPrefetchURLLoaderInterceptor::MaybeCreateLoaderForRequest(
const network::ResourceRequest& tentative_resource_request,
int frame_tree_node_id) { … }
SearchPrefetchURLLoader::RequestHandler
SearchPrefetchURLLoaderInterceptor::MaybeProxyRequestHandler(
content::BrowserContext* browser_context,
SearchPrefetchURLLoader::RequestHandler prefetched_loader_handler) { … }
void SearchPrefetchURLLoaderInterceptor::MaybeCreateLoader(
const network::ResourceRequest& tentative_resource_request,
content::BrowserContext* browser_context,
content::URLLoaderRequestInterceptor::LoaderCallback callback) { … }