#include "content/browser/renderer_host/render_frame_proxy_host.h"
#include <memory>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#include "base/containers/circular_deque.h"
#include "base/containers/contains.h"
#include "base/functional/callback.h"
#include "base/hash/hash.h"
#include "base/lazy_instance.h"
#include "base/no_destructor.h"
#include "base/trace_event/typed_macros.h"
#include "base/types/optional_util.h"
#include "content/browser/bad_message.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/renderer_host/agent_scheduling_group_host.h"
#include "content/browser/renderer_host/batched_proxy_ipc_sender.h"
#include "content/browser/renderer_host/cross_process_frame_connector.h"
#include "content/browser/renderer_host/frame_tree.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/ipc_utils.h"
#include "content/browser/renderer_host/navigation_metrics_utils.h"
#include "content/browser/renderer_host/navigator.h"
#include "content/browser/renderer_host/render_frame_host_delegate.h"
#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
#include "content/browser/site_instance_group.h"
#include "content/browser/site_instance_impl.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/disallow_activation_reason.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
#include "content/public/common/referrer_type_converters.h"
#include "ipc/ipc_message.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/network/public/cpp/web_sandbox_flags.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom.h"
#include "third_party/blink/public/mojom/messaging/transferable_message.mojom.h"
#include "third_party/blink/public/mojom/navigation/navigation_initiator_activation_and_ad_status.mojom.h"
#include "third_party/blink/public/mojom/scroll/scroll_into_view_params.mojom.h"
#include "ui/gfx/geometry/rect_f.h"
namespace content {
namespace {
RenderFrameProxyHost::TestObserver* g_observer_for_testing = …;
RenderFrameProxyHostID;
RoutingIDFrameProxyMap;
base::LazyInstance<RoutingIDFrameProxyMap>::DestructorAtExit
g_routing_id_frame_proxy_map = …;
TokenFrameMap;
base::LazyInstance<TokenFrameMap>::Leaky g_token_frame_proxy_map = …;
}
void RenderFrameProxyHost::SetObserverForTesting(TestObserver* observer) { … }
RenderFrameProxyHost* RenderFrameProxyHost::FromID(int process_id,
int routing_id) { … }
RenderFrameProxyHost* RenderFrameProxyHost::FromFrameToken(
int process_id,
const blink::RemoteFrameToken& frame_token) { … }
bool RenderFrameProxyHost::IsFrameTokenInUse(
const blink::RemoteFrameToken& frame_token) { … }
RenderFrameProxyHost::RenderFrameProxyHost(
SiteInstanceGroup* site_instance_group,
scoped_refptr<RenderViewHostImpl> render_view_host,
FrameTreeNode* frame_tree_node,
const blink::RemoteFrameToken& frame_token)
: … { … }
RenderFrameProxyHost::~RenderFrameProxyHost() { … }
void RenderFrameProxyHost::SetChildRWHView(RenderWidgetHostViewChildFrame* view,
const gfx::Size* initial_frame_size,
bool allow_paint_holding) { … }
RenderViewHostImpl* RenderFrameProxyHost::GetRenderViewHost() { … }
bool RenderFrameProxyHost::Send(IPC::Message* msg) { … }
bool RenderFrameProxyHost::OnMessageReceived(const IPC::Message& msg) { … }
std::string RenderFrameProxyHost::ToDebugString() { … }
bool RenderFrameProxyHost::InitRenderFrameProxy(
BatchedProxyIPCSender* batched_proxy_ipc_sender) { … }
AgentSchedulingGroupHost& RenderFrameProxyHost::GetAgentSchedulingGroup() { … }
void RenderFrameProxyHost::SetRenderFrameProxyCreated(bool created) { … }
const mojo::AssociatedRemote<blink::mojom::RemoteFrame>&
RenderFrameProxyHost::GetAssociatedRemoteFrame() { … }
const mojo::AssociatedRemote<blink::mojom::RemoteMainFrame>&
RenderFrameProxyHost::GetAssociatedRemoteMainFrame() { … }
void RenderFrameProxyHost::SetInheritedEffectiveTouchAction(
cc::TouchAction touch_action) { … }
void RenderFrameProxyHost::UpdateRenderThrottlingStatus(bool is_throttled,
bool subtree_throttled,
bool display_locked) { … }
void RenderFrameProxyHost::VisibilityChanged(
blink::mojom::FrameVisibility visibility) { … }
void RenderFrameProxyHost::UpdateOpener() { … }
void RenderFrameProxyHost::SetFocusedFrame() { … }
void RenderFrameProxyHost::ScrollRectToVisible(
const gfx::RectF& rect_to_scroll,
blink::mojom::ScrollIntoViewParamsPtr params) { … }
void RenderFrameProxyHost::Detach() { … }
void RenderFrameProxyHost::CheckCompleted() { … }
void RenderFrameProxyHost::EnableAutoResize(const gfx::Size& min_size,
const gfx::Size& max_size) { … }
void RenderFrameProxyHost::DisableAutoResize() { … }
void RenderFrameProxyHost::DidUpdateVisualProperties(
const cc::RenderFrameMetadata& metadata) { … }
void RenderFrameProxyHost::ChildProcessGone() { … }
void RenderFrameProxyHost::DidFocusFrame() { … }
void RenderFrameProxyHost::CapturePaintPreviewOfCrossProcessSubframe(
const gfx::Rect& clip_rect,
const base::UnguessableToken& guid) { … }
void RenderFrameProxyHost::SetIsInert(bool inert) { … }
std::u16string RenderFrameProxyHost::SerializePostMessageSourceOrigin(
const url::Origin& source_origin) { … }
void RenderFrameProxyHost::RouteMessageEvent(
const std::optional<blink::LocalFrameToken>& source_frame_token,
const url::Origin& source_origin,
const std::u16string& target_origin,
blink::TransferableMessage message) { … }
void RenderFrameProxyHost::PrintCrossProcessSubframe(const gfx::Rect& rect,
int32_t document_cookie) { … }
void RenderFrameProxyHost::SynchronizeVisualProperties(
const blink::FrameVisualProperties& frame_visual_properties) { … }
void RenderFrameProxyHost::FocusPage() { … }
void RenderFrameProxyHost::TakeFocus(bool reverse) { … }
void RenderFrameProxyHost::UpdateTargetURL(
const GURL& url,
blink::mojom::RemoteMainFrameHost::UpdateTargetURLCallback callback) { … }
void RenderFrameProxyHost::RouteCloseEvent() { … }
void RenderFrameProxyHost::OpenURL(blink::mojom::OpenURLParamsPtr params) { … }
void RenderFrameProxyHost::UpdateViewportIntersection(
blink::mojom::ViewportIntersectionStatePtr intersection_state,
const std::optional<blink::FrameVisualProperties>& visual_properties) { … }
void RenderFrameProxyHost::DidChangeOpener(
const std::optional<blink::LocalFrameToken>& opener_frame_token) { … }
void RenderFrameProxyHost::AdvanceFocus(
blink::mojom::FocusType focus_type,
const blink::LocalFrameToken& source_frame_token) { … }
bool RenderFrameProxyHost::IsInertForTesting() { … }
mojo::PendingAssociatedReceiver<blink::mojom::RemoteFrame>
RenderFrameProxyHost::BindRemoteFrameReceiverForTesting() { … }
mojo::PendingAssociatedReceiver<blink::mojom::RemoteMainFrame>
RenderFrameProxyHost::BindRemoteMainFrameReceiverForTesting() { … }
blink::mojom::RemoteFrameInterfacesFromBrowserPtr
RenderFrameProxyHost::CreateAndBindRemoteFrameInterfaces() { … }
blink::mojom::RemoteMainFrameInterfacesPtr
RenderFrameProxyHost::CreateAndBindRemoteMainFrameInterfaces() { … }
void RenderFrameProxyHost::BindRemoteFrameInterfaces(
mojo::PendingAssociatedRemote<blink::mojom::RemoteFrame> remote_frame,
mojo::PendingAssociatedReceiver<blink::mojom::RemoteFrameHost>
remote_frame_host_receiver) { … }
void RenderFrameProxyHost::BindRemoteMainFrameInterfaces(
mojo::PendingAssociatedRemote<blink::mojom::RemoteMainFrame>
remote_main_frame,
mojo::PendingAssociatedReceiver<blink::mojom::RemoteMainFrameHost>
remote_main_frame_host_receiver) { … }
void RenderFrameProxyHost::TearDownMojoConnection() { … }
void RenderFrameProxyHost::WriteIntoTrace(
perfetto::TracedProto<TraceProto> proto) const { … }
base::SafeRef<RenderFrameProxyHost> RenderFrameProxyHost::GetSafeRef() { … }
}