#include "content/browser/devtools/protocol/preload_handler.h"
#include <memory>
#include <utility>
#include "content/browser/devtools/devtools_agent_host_impl.h"
#include "content/browser/devtools/devtools_preload_storage.h"
#include "content/browser/devtools/protocol/preload.h"
#include "content/browser/devtools/render_frame_devtools_agent_host.h"
#include "content/browser/preloading/prefetch/prefetch_service.h"
#include "content/browser/preloading/preloading.h"
#include "content/browser/preloading/preloading_config.h"
#include "content/browser/preloading/prerender/prerender_final_status.h"
#include "content/browser/preloading/prerender/prerender_metrics.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/prefetch_service_delegate.h"
namespace content::protocol {
namespace {
Preload::PrerenderFinalStatus PrerenderFinalStatusToProtocol(
PrerenderFinalStatus feature) { … }
Preload::PreloadingStatus PreloadingTriggeringOutcomeToProtocol(
PreloadingTriggeringOutcome feature) { … }
Preload::PrefetchStatus PrefetchStatusToProtocol(PrefetchStatus status) { … }
bool PreloadingTriggeringOutcomeSupportedByPrefetch(
PreloadingTriggeringOutcome feature) { … }
bool PreloadingTriggeringOutcomeSupportedByPrerender(
PreloadingTriggeringOutcome feature) { … }
std::optional<protocol::Preload::SpeculationTargetHint>
GetProtocolSpeculationTargetHint(
std::optional<blink::mojom::SpeculationTargetHint> target_hint) { … }
}
PreloadHandler::PreloadHandler()
: … { … }
PreloadHandler::~PreloadHandler() = default;
std::vector<PreloadHandler*> PreloadHandler::ForAgentHost(
DevToolsAgentHostImpl* host) { … }
void PreloadHandler::DidUpdatePrefetchStatus(
const base::UnguessableToken& initiator_devtools_navigation_token,
const std::string& initiating_frame_id,
const GURL& prefetch_url,
PreloadingTriggeringOutcome status,
PrefetchStatus prefetch_status,
const std::string& request_id) { … }
void PreloadHandler::DidUpdatePrerenderStatus(
const base::UnguessableToken& initiator_devtools_navigation_token,
const GURL& prerender_url,
std::optional<blink::mojom::SpeculationTargetHint> target_hint,
PreloadingTriggeringOutcome status,
std::optional<PrerenderFinalStatus> prerender_status,
std::optional<std::string> disallowed_mojo_interface,
const std::vector<PrerenderMismatchedHeaders>* mismatched_headers) { … }
Response PreloadHandler::Enable() { … }
Response PreloadHandler::Disable() { … }
void PreloadHandler::Wire(UberDispatcher* dispatcher) { … }
void PreloadHandler::SetRenderer(int process_host_id,
RenderFrameHostImpl* frame_host) { … }
void PreloadHandler::SendInitialPreloadEnabledState() { … }
void PreloadHandler::SendCurrentPreloadStatus() { … }
}