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() { ...@@ -397,13 +397,11 @@ CrossProcessFrameConnector::GetParentRenderWidgetHostView() {
void CrossProcessFrameConnector::EnableAutoResize(const gfx::Size& min_size, void CrossProcessFrameConnector::EnableAutoResize(const gfx::Size& min_size,
const gfx::Size& max_size) { const gfx::Size& max_size) {
frame_proxy_in_parent_renderer_->Send(new FrameMsg_EnableAutoResize( frame_proxy_in_parent_renderer_->EnableAutoResize(min_size, max_size);
frame_proxy_in_parent_renderer_->GetRoutingID(), min_size, max_size));
} }
void CrossProcessFrameConnector::DisableAutoResize() { void CrossProcessFrameConnector::DisableAutoResize() {
frame_proxy_in_parent_renderer_->Send(new FrameMsg_DisableAutoResize( frame_proxy_in_parent_renderer_->DisableAutoResize();
frame_proxy_in_parent_renderer_->GetRoutingID()));
} }
bool CrossProcessFrameConnector::IsInert() const { bool CrossProcessFrameConnector::IsInert() const {
......
...@@ -313,6 +313,13 @@ RenderFrameProxyHost::GetAssociatedRemoteFrame() { ...@@ -313,6 +313,13 @@ RenderFrameProxyHost::GetAssociatedRemoteFrame() {
return remote_frame_; 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( void RenderFrameProxyHost::SetInheritedEffectiveTouchAction(
cc::TouchAction touch_action) { cc::TouchAction touch_action) {
cross_process_frame_connector_->OnSetInheritedEffectiveTouchAction( cross_process_frame_connector_->OnSetInheritedEffectiveTouchAction(
...@@ -433,6 +440,15 @@ void RenderFrameProxyHost::CheckCompleted() { ...@@ -433,6 +440,15 @@ void RenderFrameProxyHost::CheckCompleted() {
target_rfh->GetAssociatedLocalFrame()->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( void RenderFrameProxyHost::OnRouteMessageEvent(
const FrameMsg_PostMessage_Params& params) { const FrameMsg_PostMessage_Params& params) {
RenderFrameHostImpl* target_rfh = frame_tree_node()->current_frame_host(); RenderFrameHostImpl* target_rfh = frame_tree_node()->current_frame_host();
......
...@@ -155,6 +155,17 @@ class CONTENT_EXPORT RenderFrameProxyHost ...@@ -155,6 +155,17 @@ class CONTENT_EXPORT RenderFrameProxyHost
const gfx::Rect& clip_rect, const gfx::Rect& clip_rect,
const base::UnguessableToken& guid) override; 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(); blink::AssociatedInterfaceProvider* GetRemoteAssociatedInterfacesTesting();
private: private:
...@@ -216,6 +227,9 @@ class CONTENT_EXPORT RenderFrameProxyHost ...@@ -216,6 +227,9 @@ class CONTENT_EXPORT RenderFrameProxyHost
// Holder of Mojo connection with the Frame service in Blink. // Holder of Mojo connection with the Frame service in Blink.
mojo::AssociatedRemote<blink::mojom::RemoteFrame> remote_frame_; 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> mojo::AssociatedReceiver<blink::mojom::RemoteFrameHost>
remote_frame_host_receiver_{this}; remote_frame_host_receiver_{this};
......
...@@ -631,16 +631,6 @@ IPC_MESSAGE_ROUTED1(FrameMsg_SetTextTrackSettings, ...@@ -631,16 +631,6 @@ IPC_MESSAGE_ROUTED1(FrameMsg_SetTextTrackSettings,
IPC_MESSAGE_ROUTED1(FrameMsg_DidUpdateVisualProperties, IPC_MESSAGE_ROUTED1(FrameMsg_DidUpdateVisualProperties,
cc::RenderFrameMetadata /* metadata */) 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 BUILDFLAG(USE_EXTERNAL_POPUP_MENU)
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
IPC_MESSAGE_ROUTED1(FrameMsg_SelectPopupMenuItem, IPC_MESSAGE_ROUTED1(FrameMsg_SelectPopupMenuItem,
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
module content.mojom; module content.mojom;
import "ui/gfx/geometry/mojom/geometry.mojom";
// Mojo interface for communicating from RenderFrameProxy to // Mojo interface for communicating from RenderFrameProxy to
// RenderFrameProxyHost. // RenderFrameProxyHost.
interface RenderFrameProxyHost { interface RenderFrameProxyHost {
...@@ -11,3 +13,12 @@ interface RenderFrameProxyHost { ...@@ -11,3 +13,12 @@ interface RenderFrameProxyHost {
// blink::RemoteFrameHost but we might still need this. // 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) { ...@@ -423,8 +423,6 @@ bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) {
OnSetFrameOwnerProperties) OnSetFrameOwnerProperties)
IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateVisualProperties, IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateVisualProperties,
OnDidUpdateVisualProperties) OnDidUpdateVisualProperties)
IPC_MESSAGE_HANDLER(FrameMsg_EnableAutoResize, OnEnableAutoResize)
IPC_MESSAGE_HANDLER(FrameMsg_DisableAutoResize, OnDisableAutoResize)
IPC_MESSAGE_HANDLER(FrameMsg_TransferUserActivationFrom, IPC_MESSAGE_HANDLER(FrameMsg_TransferUserActivationFrom,
OnTransferUserActivationFrom) OnTransferUserActivationFrom)
IPC_MESSAGE_HANDLER(UnfreezableFrameMsg_DeleteProxy, OnDeleteProxy) IPC_MESSAGE_HANDLER(UnfreezableFrameMsg_DeleteProxy, OnDeleteProxy)
...@@ -438,7 +436,13 @@ bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) { ...@@ -438,7 +436,13 @@ bool RenderFrameProxy::OnMessageReceived(const IPC::Message& msg) {
void RenderFrameProxy::OnAssociatedInterfaceRequest( void RenderFrameProxy::OnAssociatedInterfaceRequest(
const std::string& interface_name, const std::string& interface_name,
mojo::ScopedInterfaceEndpointHandle handle) { 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) { bool RenderFrameProxy::Send(IPC::Message* message) {
...@@ -508,8 +512,8 @@ void RenderFrameProxy::OnDidUpdateVisualProperties( ...@@ -508,8 +512,8 @@ void RenderFrameProxy::OnDidUpdateVisualProperties(
SynchronizeVisualProperties(); SynchronizeVisualProperties();
} }
void RenderFrameProxy::OnEnableAutoResize(const gfx::Size& min_size, void RenderFrameProxy::EnableAutoResize(const gfx::Size& min_size,
const gfx::Size& max_size) { const gfx::Size& max_size) {
DCHECK(ancestor_render_widget_); DCHECK(ancestor_render_widget_);
pending_visual_properties_.auto_resize_enabled = true; pending_visual_properties_.auto_resize_enabled = true;
...@@ -518,7 +522,7 @@ void RenderFrameProxy::OnEnableAutoResize(const gfx::Size& min_size, ...@@ -518,7 +522,7 @@ void RenderFrameProxy::OnEnableAutoResize(const gfx::Size& min_size,
SynchronizeVisualProperties(); SynchronizeVisualProperties();
} }
void RenderFrameProxy::OnDisableAutoResize() { void RenderFrameProxy::DisableAutoResize() {
DCHECK(ancestor_render_widget_); DCHECK(ancestor_render_widget_);
pending_visual_properties_.auto_resize_enabled = false; pending_visual_properties_.auto_resize_enabled = false;
......
...@@ -17,11 +17,13 @@ ...@@ -17,11 +17,13 @@
#include "content/renderer/child_frame_compositor.h" #include "content/renderer/child_frame_compositor.h"
#include "ipc/ipc_listener.h" #include "ipc/ipc_listener.h"
#include "ipc/ipc_sender.h" #include "ipc/ipc_sender.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/associated_remote.h"
#include "services/service_manager/public/cpp/binder_registry.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_provider.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.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/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/frame/user_activation_update_types.mojom.h"
#include "third_party/blink/public/mojom/input/focus_type.mojom-forward.h" #include "third_party/blink/public/mojom/input/focus_type.mojom-forward.h"
#include "third_party/blink/public/platform/web_insecure_request_policy.h" #include "third_party/blink/public/platform/web_insecure_request_policy.h"
...@@ -67,7 +69,8 @@ struct FrameReplicationState; ...@@ -67,7 +69,8 @@ struct FrameReplicationState;
class CONTENT_EXPORT RenderFrameProxy : public IPC::Listener, class CONTENT_EXPORT RenderFrameProxy : public IPC::Listener,
public IPC::Sender, public IPC::Sender,
public ChildFrameCompositor, public ChildFrameCompositor,
public blink::WebRemoteFrameClient { public blink::WebRemoteFrameClient,
public mojom::RenderFrameProxy {
public: public:
// This method should be used to create a RenderFrameProxy, which will replace // This method should be used to create a RenderFrameProxy, which will replace
// an existing RenderFrame during its cross-process navigation from the // an existing RenderFrame during its cross-process navigation from the
...@@ -235,8 +238,9 @@ class CONTENT_EXPORT RenderFrameProxy : public IPC::Listener, ...@@ -235,8 +238,9 @@ class CONTENT_EXPORT RenderFrameProxy : public IPC::Listener,
void OnSetFrameOwnerProperties(const FrameOwnerProperties& properties); void OnSetFrameOwnerProperties(const FrameOwnerProperties& properties);
void OnTransferUserActivationFrom(int32_t source_routing_id); void OnTransferUserActivationFrom(int32_t source_routing_id);
void OnDidUpdateVisualProperties(const cc::RenderFrameMetadata& metadata); void OnDidUpdateVisualProperties(const cc::RenderFrameMetadata& metadata);
void OnEnableAutoResize(const gfx::Size& min_size, const gfx::Size& max_size); void EnableAutoResize(const gfx::Size& min_size,
void OnDisableAutoResize(); const gfx::Size& max_size) override;
void DisableAutoResize() override;
// ChildFrameCompositor: // ChildFrameCompositor:
cc::Layer* GetLayer() override; cc::Layer* GetLayer() override;
...@@ -264,6 +268,10 @@ class CONTENT_EXPORT RenderFrameProxy : public IPC::Listener, ...@@ -264,6 +268,10 @@ class CONTENT_EXPORT RenderFrameProxy : public IPC::Listener,
std::unique_ptr<blink::AssociatedInterfaceProvider> std::unique_ptr<blink::AssociatedInterfaceProvider>
remote_associated_interfaces_; 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. // Can be nullptr when this RenderFrameProxy's parent is not a RenderFrame.
std::unique_ptr<ChildFrameCompositingHelper> compositing_helper_; 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