Commit 948fa6d8 authored by Abhijeet Kandalkar's avatar Abhijeet Kandalkar Committed by Commit Bot

Introduce content::mojom::RenderFrameProxy

Add interface |RenderFrameProxy| to frame_proxy.mojom and have class
content::RenderFrameProxy implement it. Also, remove unwanted
FrameMsg_EnableAutoResize and FrameMsg_DisableAutoResize.

Bug: 1041061
Change-Id: Id71ad8116eec9d2d2c37c88bb5029068e4b408bc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032661Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Commit-Queue: Abhijeet Kandalkar <abhijeet@igalia.com>
Cr-Commit-Position: refs/heads/master@{#739304}
parent 8ce5fa14
......@@ -397,13 +397,11 @@ CrossProcessFrameConnector::GetParentRenderWidgetHostView() {
void CrossProcessFrameConnector::EnableAutoResize(const gfx::Size& min_size,
const gfx::Size& max_size) {
frame_proxy_in_parent_renderer_->Send(new FrameMsg_EnableAutoResize(
frame_proxy_in_parent_renderer_->GetRoutingID(), min_size, max_size));
frame_proxy_in_parent_renderer_->EnableAutoResize(min_size, max_size);
}
void CrossProcessFrameConnector::DisableAutoResize() {
frame_proxy_in_parent_renderer_->Send(new FrameMsg_DisableAutoResize(
frame_proxy_in_parent_renderer_->GetRoutingID()));
frame_proxy_in_parent_renderer_->DisableAutoResize();
}
bool CrossProcessFrameConnector::IsInert() const {
......
......@@ -313,6 +313,13 @@ RenderFrameProxyHost::GetAssociatedRemoteFrame() {
return remote_frame_;
}
const mojo::AssociatedRemote<content::mojom::RenderFrameProxy>&
RenderFrameProxyHost::GetAssociatedRenderFrameProxy() {
if (!render_frame_proxy_)
GetRemoteAssociatedInterfaces()->GetInterface(&render_frame_proxy_);
return render_frame_proxy_;
}
void RenderFrameProxyHost::SetInheritedEffectiveTouchAction(
cc::TouchAction touch_action) {
cross_process_frame_connector_->OnSetInheritedEffectiveTouchAction(
......@@ -433,6 +440,15 @@ void RenderFrameProxyHost::CheckCompleted() {
target_rfh->GetAssociatedLocalFrame()->CheckCompleted();
}
void RenderFrameProxyHost::EnableAutoResize(const gfx::Size& min_size,
const gfx::Size& max_size) {
GetAssociatedRenderFrameProxy()->EnableAutoResize(min_size, max_size);
}
void RenderFrameProxyHost::DisableAutoResize() {
GetAssociatedRenderFrameProxy()->DisableAutoResize();
}
void RenderFrameProxyHost::OnRouteMessageEvent(
const FrameMsg_PostMessage_Params& params) {
RenderFrameHostImpl* target_rfh = frame_tree_node()->current_frame_host();
......
......@@ -155,6 +155,17 @@ class CONTENT_EXPORT RenderFrameProxyHost
const gfx::Rect& clip_rect,
const base::UnguessableToken& guid) override;
// Returns associated remote for the content::mojom::RenderFrameProxy Mojo
// interface.
const mojo::AssociatedRemote<mojom::RenderFrameProxy>&
GetAssociatedRenderFrameProxy();
// Requests a viz::LocalSurfaceId to enable auto-resize mode from the parent
// renderer.
void EnableAutoResize(const gfx::Size& min_size, const gfx::Size& max_size);
// Requests a viz::LocalSurfaceId to disable auto-resize mode from the parent
// renderer.
void DisableAutoResize();
blink::AssociatedInterfaceProvider* GetRemoteAssociatedInterfacesTesting();
private:
......@@ -216,6 +227,9 @@ class CONTENT_EXPORT RenderFrameProxyHost
// Holder of Mojo connection with the Frame service in Blink.
mojo::AssociatedRemote<blink::mojom::RemoteFrame> remote_frame_;
// Holder of Mojo connection with the content::mojom::RenderFrameProxy.
mojo::AssociatedRemote<mojom::RenderFrameProxy> render_frame_proxy_;
mojo::AssociatedReceiver<blink::mojom::RemoteFrameHost>
remote_frame_host_receiver_{this};
......
......@@ -631,16 +631,6 @@ IPC_MESSAGE_ROUTED1(FrameMsg_SetTextTrackSettings,
IPC_MESSAGE_ROUTED1(FrameMsg_DidUpdateVisualProperties,
cc::RenderFrameMetadata /* metadata */)
// Requests a viz::LocalSurfaceId to enable auto-resize mode from the parent
// renderer.
IPC_MESSAGE_ROUTED2(FrameMsg_EnableAutoResize,
gfx::Size /* min_size */,
gfx::Size /* max_size */)
// Requests a viz::LocalSurfaceId to disable auto-resize-mode from the parent
// renderer.
IPC_MESSAGE_ROUTED0(FrameMsg_DisableAutoResize)
#if BUILDFLAG(USE_EXTERNAL_POPUP_MENU)
#if defined(OS_MACOSX)
IPC_MESSAGE_ROUTED1(FrameMsg_SelectPopupMenuItem,
......
......@@ -4,6 +4,8 @@
module content.mojom;
import "ui/gfx/geometry/mojom/geometry.mojom";
// Mojo interface for communicating from RenderFrameProxy to
// RenderFrameProxyHost.
interface RenderFrameProxyHost {
......@@ -11,3 +13,12 @@ interface RenderFrameProxyHost {
// blink::RemoteFrameHost but we might still need this.
};
// Mojo interface for communicating from RenderFrameProxyHost to
// RenderFrameProxy. The Renderer process implements the below interface.
interface RenderFrameProxy {
// This function enables auto-resize mode from the parent renderer.
EnableAutoResize(gfx.mojom.Size min_size, gfx.mojom.Size max_size);
// This function disables auto-resize-mode from the parent renderer.
DisableAutoResize();
};
......@@ -423,8 +423,6 @@ bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) {
OnSetFrameOwnerProperties)
IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateVisualProperties,
OnDidUpdateVisualProperties)
IPC_MESSAGE_HANDLER(FrameMsg_EnableAutoResize, OnEnableAutoResize)
IPC_MESSAGE_HANDLER(FrameMsg_DisableAutoResize, OnDisableAutoResize)
IPC_MESSAGE_HANDLER(FrameMsg_TransferUserActivationFrom,
OnTransferUserActivationFrom)
IPC_MESSAGE_HANDLER(UnfreezableFrameMsg_DeleteProxy, OnDeleteProxy)
......@@ -438,7 +436,13 @@ bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) {
void RenderFrameProxy::OnAssociatedInterfaceRequest(
const std::string& interface_name,
mojo::ScopedInterfaceEndpointHandle handle) {
associated_interfaces_.TryBindInterface(interface_name, &handle);
if (interface_name == blink::mojom::RemoteFrame::Name_) {
associated_interfaces_.TryBindInterface(interface_name, &handle);
} else if (interface_name == content::mojom::RenderFrameProxy::Name_) {
render_frame_proxy_receiver_.Bind(
mojo::PendingAssociatedReceiver<mojom::RenderFrameProxy>(
std::move(handle)));
}
}
bool RenderFrameProxy::Send(IPC::Message* message) {
......@@ -508,8 +512,8 @@ void RenderFrameProxy::OnDidUpdateVisualProperties(
SynchronizeVisualProperties();
}
void RenderFrameProxy::OnEnableAutoResize(const gfx::Size& min_size,
const gfx::Size& max_size) {
void RenderFrameProxy::EnableAutoResize(const gfx::Size& min_size,
const gfx::Size& max_size) {
DCHECK(ancestor_render_widget_);
pending_visual_properties_.auto_resize_enabled = true;
......@@ -518,7 +522,7 @@ void RenderFrameProxy::OnEnableAutoResize(const gfx::Size& min_size,
SynchronizeVisualProperties();
}
void RenderFrameProxy::OnDisableAutoResize() {
void RenderFrameProxy::DisableAutoResize() {
DCHECK(ancestor_render_widget_);
pending_visual_properties_.auto_resize_enabled = false;
......
......@@ -17,11 +17,13 @@
#include "content/renderer/child_frame_compositor.h"
#include "ipc/ipc_listener.h"
#include "ipc/ipc_sender.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "services/service_manager/public/cpp/binder_registry.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/common/feature_policy/feature_policy.h"
#include "third_party/blink/public/mojom/frame/frame.mojom.h"
#include "third_party/blink/public/mojom/frame/user_activation_update_types.mojom.h"
#include "third_party/blink/public/mojom/input/focus_type.mojom-forward.h"
#include "third_party/blink/public/platform/web_insecure_request_policy.h"
......@@ -67,7 +69,8 @@ struct FrameReplicationState;
class CONTENT_EXPORT RenderFrameProxy : public IPC::Listener,
public IPC::Sender,
public ChildFrameCompositor,
public blink::WebRemoteFrameClient {
public blink::WebRemoteFrameClient,
public mojom::RenderFrameProxy {
public:
// This method should be used to create a RenderFrameProxy, which will replace
// an existing RenderFrame during its cross-process navigation from the
......@@ -235,8 +238,9 @@ class CONTENT_EXPORT RenderFrameProxy : public IPC::Listener,
void OnSetFrameOwnerProperties(const FrameOwnerProperties& properties);
void OnTransferUserActivationFrom(int32_t source_routing_id);
void OnDidUpdateVisualProperties(const cc::RenderFrameMetadata& metadata);
void OnEnableAutoResize(const gfx::Size& min_size, const gfx::Size& max_size);
void OnDisableAutoResize();
void EnableAutoResize(const gfx::Size& min_size,
const gfx::Size& max_size) override;
void DisableAutoResize() override;
// ChildFrameCompositor:
cc::Layer* GetLayer() override;
......@@ -264,6 +268,10 @@ class CONTENT_EXPORT RenderFrameProxy : public IPC::Listener,
std::unique_ptr<blink::AssociatedInterfaceProvider>
remote_associated_interfaces_;
// Mojo receiver to this content::mojom::RenderFrameProxy.
mojo::AssociatedReceiver<mojom::RenderFrameProxy>
render_frame_proxy_receiver_{this};
// Can be nullptr when this RenderFrameProxy's parent is not a RenderFrame.
std::unique_ptr<ChildFrameCompositingHelper> compositing_helper_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment