#include "components/no_state_prefetch/browser/no_state_prefetch_contents.h"
#include <stddef.h>
#include <functional>
#include <optional>
#include <utility>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ptr.h"
#include "base/observer_list.h"
#include "base/process/kill.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "components/no_state_prefetch/browser/no_state_prefetch_contents_delegate.h"
#include "components/no_state_prefetch/browser/no_state_prefetch_manager.h"
#include "components/no_state_prefetch/common/no_state_prefetch_final_status.h"
#include "components/no_state_prefetch/common/no_state_prefetch_utils.h"
#include "components/no_state_prefetch/common/render_frame_prerender_messages.mojom.h"
#include "components/paint_preview/browser/paint_preview_client.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/preloading.h"
#include "content/public/browser/preloading_data.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/session_storage_namespace.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
#include "net/http/http_response_headers.h"
#include "services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.h"
#include "services/service_manager/public/cpp/binder_registry.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "ui/base/page_transition_types.h"
#include "ui/gfx/geometry/size.h"
BrowserThread;
OpenURLParams;
RenderFrameHost;
SessionStorageNamespace;
WebContents;
namespace prerender {
class NoStatePrefetchContentsFactoryImpl
: public NoStatePrefetchContents::Factory { … };
void SetPreloadingTriggeringOutcome(
content::PreloadingAttempt* attempt,
content::PreloadingTriggeringOutcome outcome) { … }
content::PreloadingFailureReason ToPreloadingFailureReason(FinalStatus status) { … }
class NoStatePrefetchContents::WebContentsDelegateImpl
: public content::WebContentsDelegate { … };
NoStatePrefetchContents::Observer::~Observer() { … }
NoStatePrefetchContents::NoStatePrefetchContents(
std::unique_ptr<NoStatePrefetchContentsDelegate> delegate,
NoStatePrefetchManager* no_state_prefetch_manager,
content::BrowserContext* browser_context,
const GURL& url,
const content::Referrer& referrer,
const std::optional<url::Origin>& initiator_origin,
Origin origin)
: … { … }
bool NoStatePrefetchContents::Init() { … }
NoStatePrefetchContents::Factory* NoStatePrefetchContents::CreateFactory() { … }
void NoStatePrefetchContents::SetPreloadingFailureReason(FinalStatus status) { … }
void NoStatePrefetchContents::StartPrerendering(
const gfx::Rect& bounds,
SessionStorageNamespace* session_storage_namespace,
base::WeakPtr<content::PreloadingAttempt> attempt) { … }
void NoStatePrefetchContents::SetFinalStatus(FinalStatus final_status) { … }
NoStatePrefetchContents::~NoStatePrefetchContents() { … }
void NoStatePrefetchContents::AddObserver(Observer* observer) { … }
void NoStatePrefetchContents::RemoveObserver(Observer* observer) { … }
std::unique_ptr<WebContents> NoStatePrefetchContents::CreateWebContents(
SessionStorageNamespace* session_storage_namespace) { … }
void NoStatePrefetchContents::NotifyPrefetchStart() { … }
void NoStatePrefetchContents::NotifyPrefetchStopLoading() { … }
void NoStatePrefetchContents::NotifyPrefetchStop() { … }
bool NoStatePrefetchContents::CheckURL(const GURL& url) { … }
bool NoStatePrefetchContents::AddAliasURL(const GURL& url) { … }
bool NoStatePrefetchContents::Matches(
const GURL& url,
SessionStorageNamespace* session_storage_namespace) const { … }
void NoStatePrefetchContents::PrimaryMainFrameRenderProcessGone(
base::TerminationStatus status) { … }
void NoStatePrefetchContents::RenderFrameCreated(
content::RenderFrameHost* render_frame_host) { … }
void NoStatePrefetchContents::DidStopLoading() { … }
void NoStatePrefetchContents::DidStartNavigation(
content::NavigationHandle* navigation_handle) { … }
void NoStatePrefetchContents::DidRedirectNavigation(
content::NavigationHandle* navigation_handle) { … }
void NoStatePrefetchContents::DidFinishLoad(
content::RenderFrameHost* render_frame_host,
const GURL& validated_url) { … }
void NoStatePrefetchContents::DidFinishNavigation(
content::NavigationHandle* navigation_handle) { … }
void NoStatePrefetchContents::Destroy(FinalStatus final_status) { … }
void NoStatePrefetchContents::DestroyWhenUsingTooManyResources() { … }
void NoStatePrefetchContents::DidGetMemoryUsage(
bool success,
std::unique_ptr<memory_instrumentation::GlobalMemoryDump> global_dump) { … }
RenderFrameHost* NoStatePrefetchContents::GetPrimaryMainFrame() { … }
std::optional<base::Value::Dict> NoStatePrefetchContents::GetAsDict() const { … }
void NoStatePrefetchContents::MarkAsUsedForTesting() { … }
void NoStatePrefetchContents::CancelPrerenderForUnsupportedScheme() { … }
void NoStatePrefetchContents::CancelPrerenderForNoStatePrefetch() { … }
void NoStatePrefetchContents::AddPrerenderCancelerReceiver(
mojo::PendingReceiver<prerender::mojom::PrerenderCanceler> receiver) { … }
}