Commit a0fbec3e authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

Convert remote_cocoa::mojom::StubInterface to new Mojo types

It converts remote_cocoa::mojom::StubInterface from
application.mojom to new Mojo types using PendingAssociatedReceiver,
AssociatedReceiver, PendingAssociatedRemote, and AssociatedRemote.

Bug: 955171
Change-Id: I8ab0dcc86445e14dc6ab966e1b2729fbe714931b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1893609Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Reviewed-by: default avatarElly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Commit-Queue: Julie Kim <jkim@igalia.com>
Cr-Commit-Position: refs/heads/master@{#714826}
parent 5c33ddf9
...@@ -57,12 +57,14 @@ class REMOTE_COCOA_APP_SHIM_EXPORT ApplicationBridge ...@@ -57,12 +57,14 @@ class REMOTE_COCOA_APP_SHIM_EXPORT ApplicationBridge
mojo::PendingAssociatedRemote<mojom::TextInputHost> text_input_host) mojo::PendingAssociatedRemote<mojom::TextInputHost> text_input_host)
override; override;
void CreateRenderWidgetHostNSView( void CreateRenderWidgetHostNSView(
mojom::StubInterfaceAssociatedPtrInfo host, mojo::PendingAssociatedRemote<mojom::StubInterface> host,
mojom::StubInterfaceAssociatedRequest view_request) override; mojo::PendingAssociatedReceiver<mojom::StubInterface> view_receiver)
override;
void CreateWebContentsNSView( void CreateWebContentsNSView(
uint64_t view_id, uint64_t view_id,
mojom::StubInterfaceAssociatedPtrInfo host, mojo::PendingAssociatedRemote<mojom::StubInterface> host,
mojom::StubInterfaceAssociatedRequest view_request) override; mojo::PendingAssociatedReceiver<mojom::StubInterface> view_receiver)
override;
private: private:
friend class base::NoDestructor<ApplicationBridge>; friend class base::NoDestructor<ApplicationBridge>;
......
...@@ -147,22 +147,22 @@ void ApplicationBridge::CreateNativeWidgetNSWindow( ...@@ -147,22 +147,22 @@ void ApplicationBridge::CreateNativeWidgetNSWindow(
} }
void ApplicationBridge::CreateRenderWidgetHostNSView( void ApplicationBridge::CreateRenderWidgetHostNSView(
mojom::StubInterfaceAssociatedPtrInfo host, mojo::PendingAssociatedRemote<mojom::StubInterface> host,
mojom::StubInterfaceAssociatedRequest view_request) { mojo::PendingAssociatedReceiver<mojom::StubInterface> view_receiver) {
if (!render_widget_host_create_callback_) if (!render_widget_host_create_callback_)
return; return;
render_widget_host_create_callback_.Run(host.PassHandle(), render_widget_host_create_callback_.Run(host.PassHandle(),
view_request.PassHandle()); view_receiver.PassHandle());
} }
void ApplicationBridge::CreateWebContentsNSView( void ApplicationBridge::CreateWebContentsNSView(
uint64_t view_id, uint64_t view_id,
mojom::StubInterfaceAssociatedPtrInfo host, mojo::PendingAssociatedRemote<mojom::StubInterface> host,
mojom::StubInterfaceAssociatedRequest view_request) { mojo::PendingAssociatedReceiver<mojom::StubInterface> view_receiver) {
if (!web_conents_create_callback_) if (!web_conents_create_callback_)
return; return;
web_conents_create_callback_.Run(view_id, host.PassHandle(), web_conents_create_callback_.Run(view_id, host.PassHandle(),
view_request.PassHandle()); view_receiver.PassHandle());
} }
ApplicationBridge::ApplicationBridge() = default; ApplicationBridge::ApplicationBridge() = default;
......
...@@ -44,8 +44,8 @@ interface Application { ...@@ -44,8 +44,8 @@ interface Application {
// Create and take ownership of the NSView for a RenderWidgetHostView. The // Create and take ownership of the NSView for a RenderWidgetHostView. The
// resulting object will be destroyed when the connection is closed. // resulting object will be destroyed when the connection is closed.
CreateRenderWidgetHostNSView( CreateRenderWidgetHostNSView(
associated StubInterface host, pending_associated_remote<StubInterface> host,
associated StubInterface& view_request); pending_associated_receiver<StubInterface> view_receiver);
// Create and take ownership of the NSView for a WebContentsView. The // Create and take ownership of the NSView for a WebContentsView. The
// resulting object will be destroyed when the connection is closed. // resulting object will be destroyed when the connection is closed.
...@@ -53,7 +53,7 @@ interface Application { ...@@ -53,7 +53,7 @@ interface Application {
// child NSViews. // child NSViews.
CreateWebContentsNSView( CreateWebContentsNSView(
uint64 view_id, uint64 view_id,
associated StubInterface host, pending_associated_remote<StubInterface> host,
associated StubInterface& view_request); pending_associated_receiver<StubInterface> view_receiver);
}; };
...@@ -267,18 +267,17 @@ void RenderWidgetHostViewMac::MigrateNSViewBridge( ...@@ -267,18 +267,17 @@ void RenderWidgetHostViewMac::MigrateNSViewBridge(
mojo::PendingAssociatedReceiver<remote_cocoa::mojom::RenderWidgetHostNSView> mojo::PendingAssociatedReceiver<remote_cocoa::mojom::RenderWidgetHostNSView>
view_receiver = remote_ns_view_.BindNewEndpointAndPassReceiver(); view_receiver = remote_ns_view_.BindNewEndpointAndPassReceiver();
// Cast from mojom::RenderWidgetHostNSViewHostPtr and // Cast from PendingAssociatedRemote<mojom::RenderWidgetHostNSViewHost> and
// mojo::PendingAssociatedReceiver<mojom::RenderWidgetHostNSView> to the // mojo::PendingAssociatedReceiver<mojom::RenderWidgetHostNSView> to the
// public interfaces accepted by the application. // public interfaces accepted by the application.
// TODO(ccameron): Remove the need for this cast. // TODO(ccameron): Remove the need for this cast.
// https://crbug.com/888290 // https://crbug.com/888290
mojo::AssociatedInterfacePtrInfo<remote_cocoa::mojom::StubInterface> mojo::PendingAssociatedRemote<remote_cocoa::mojom::StubInterface> stub_client(
stub_client(client.PassHandle(), 0); client.PassHandle(), 0);
remote_cocoa::mojom::StubInterfaceAssociatedRequest stub_bridge_request( mojo::PendingAssociatedReceiver<remote_cocoa::mojom::StubInterface>
view_receiver.PassHandle()); stub_bridge_receiver(view_receiver.PassHandle());
remote_cocoa_application->CreateRenderWidgetHostNSView( remote_cocoa_application->CreateRenderWidgetHostNSView(
std::move(stub_client), std::move(stub_bridge_request)); std::move(stub_client), std::move(stub_bridge_receiver));
ns_view_ = remote_ns_view_.get(); ns_view_ = remote_ns_view_.get();
remote_ns_view_->SetParentWebContentsNSView(parent_ns_view_id); remote_ns_view_->SetParentWebContentsNSView(parent_ns_view_id);
......
...@@ -639,18 +639,18 @@ void WebContentsViewMac::ViewsHostableAttach( ...@@ -639,18 +639,18 @@ void WebContentsViewMac::ViewsHostableAttach(
mojo::PendingAssociatedReceiver<remote_cocoa::mojom::WebContentsNSView> mojo::PendingAssociatedReceiver<remote_cocoa::mojom::WebContentsNSView>
ns_view_receiver = remote_ns_view_.BindNewEndpointAndPassReceiver(); ns_view_receiver = remote_ns_view_.BindNewEndpointAndPassReceiver();
// Cast from mojo::AssociatedRemote<mojom::WebContentsNSViewHost> and // Cast from mojo::PendingAssociatedRemote<mojom::WebContentsNSViewHost> and
// mojo::PendingAssociatedReceiver<remote_cocoa::mojom::WebContentsNSView> // mojo::PendingAssociatedReceiver<remote_cocoa::mojom::WebContentsNSView>
// to the public interfaces accepted by the application. // to the public interfaces accepted by the application.
// TODO(ccameron): Remove the need for this cast. // TODO(ccameron): Remove the need for this cast.
// https://crbug.com/888290 // https://crbug.com/888290
mojo::AssociatedInterfacePtrInfo<remote_cocoa::mojom::StubInterface> mojo::PendingAssociatedRemote<remote_cocoa::mojom::StubInterface> stub_host(
stub_host(host.PassHandle(), 0); host.PassHandle(), 0);
remote_cocoa::mojom::StubInterfaceAssociatedRequest stub_ns_view_request( mojo::PendingAssociatedReceiver<remote_cocoa::mojom::StubInterface>
ns_view_receiver.PassHandle()); stub_ns_view_receiver(ns_view_receiver.PassHandle());
remote_cocoa_application->CreateWebContentsNSView( remote_cocoa_application->CreateWebContentsNSView(
ns_view_id_, std::move(stub_host), std::move(stub_ns_view_request)); ns_view_id_, std::move(stub_host), std::move(stub_ns_view_receiver));
remote_ns_view_->SetParentNSView(views_host_->GetNSViewId()); remote_ns_view_->SetParentNSView(views_host_->GetNSViewId());
// Because this view is being displayed from a remote process, reset the // Because this view is being displayed from a remote process, reset the
......
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