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
mojo::PendingAssociatedRemote<mojom::TextInputHost> text_input_host)
override;
void CreateRenderWidgetHostNSView(
mojom::StubInterfaceAssociatedPtrInfo host,
mojom::StubInterfaceAssociatedRequest view_request) override;
mojo::PendingAssociatedRemote<mojom::StubInterface> host,
mojo::PendingAssociatedReceiver<mojom::StubInterface> view_receiver)
override;
void CreateWebContentsNSView(
uint64_t view_id,
mojom::StubInterfaceAssociatedPtrInfo host,
mojom::StubInterfaceAssociatedRequest view_request) override;
mojo::PendingAssociatedRemote<mojom::StubInterface> host,
mojo::PendingAssociatedReceiver<mojom::StubInterface> view_receiver)
override;
private:
friend class base::NoDestructor<ApplicationBridge>;
......
......@@ -147,22 +147,22 @@ void ApplicationBridge::CreateNativeWidgetNSWindow(
}
void ApplicationBridge::CreateRenderWidgetHostNSView(
mojom::StubInterfaceAssociatedPtrInfo host,
mojom::StubInterfaceAssociatedRequest view_request) {
mojo::PendingAssociatedRemote<mojom::StubInterface> host,
mojo::PendingAssociatedReceiver<mojom::StubInterface> view_receiver) {
if (!render_widget_host_create_callback_)
return;
render_widget_host_create_callback_.Run(host.PassHandle(),
view_request.PassHandle());
view_receiver.PassHandle());
}
void ApplicationBridge::CreateWebContentsNSView(
uint64_t view_id,
mojom::StubInterfaceAssociatedPtrInfo host,
mojom::StubInterfaceAssociatedRequest view_request) {
mojo::PendingAssociatedRemote<mojom::StubInterface> host,
mojo::PendingAssociatedReceiver<mojom::StubInterface> view_receiver) {
if (!web_conents_create_callback_)
return;
web_conents_create_callback_.Run(view_id, host.PassHandle(),
view_request.PassHandle());
view_receiver.PassHandle());
}
ApplicationBridge::ApplicationBridge() = default;
......
......@@ -44,8 +44,8 @@ interface Application {
// Create and take ownership of the NSView for a RenderWidgetHostView. The
// resulting object will be destroyed when the connection is closed.
CreateRenderWidgetHostNSView(
associated StubInterface host,
associated StubInterface& view_request);
pending_associated_remote<StubInterface> host,
pending_associated_receiver<StubInterface> view_receiver);
// Create and take ownership of the NSView for a WebContentsView. The
// resulting object will be destroyed when the connection is closed.
......@@ -53,7 +53,7 @@ interface Application {
// child NSViews.
CreateWebContentsNSView(
uint64 view_id,
associated StubInterface host,
associated StubInterface& view_request);
pending_associated_remote<StubInterface> host,
pending_associated_receiver<StubInterface> view_receiver);
};
......@@ -267,18 +267,17 @@ void RenderWidgetHostViewMac::MigrateNSViewBridge(
mojo::PendingAssociatedReceiver<remote_cocoa::mojom::RenderWidgetHostNSView>
view_receiver = remote_ns_view_.BindNewEndpointAndPassReceiver();
// Cast from mojom::RenderWidgetHostNSViewHostPtr and
// Cast from PendingAssociatedRemote<mojom::RenderWidgetHostNSViewHost> and
// mojo::PendingAssociatedReceiver<mojom::RenderWidgetHostNSView> to the
// public interfaces accepted by the application.
// TODO(ccameron): Remove the need for this cast.
// https://crbug.com/888290
mojo::AssociatedInterfacePtrInfo<remote_cocoa::mojom::StubInterface>
stub_client(client.PassHandle(), 0);
remote_cocoa::mojom::StubInterfaceAssociatedRequest stub_bridge_request(
view_receiver.PassHandle());
mojo::PendingAssociatedRemote<remote_cocoa::mojom::StubInterface> stub_client(
client.PassHandle(), 0);
mojo::PendingAssociatedReceiver<remote_cocoa::mojom::StubInterface>
stub_bridge_receiver(view_receiver.PassHandle());
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();
remote_ns_view_->SetParentWebContentsNSView(parent_ns_view_id);
......
......@@ -639,18 +639,18 @@ void WebContentsViewMac::ViewsHostableAttach(
mojo::PendingAssociatedReceiver<remote_cocoa::mojom::WebContentsNSView>
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>
// to the public interfaces accepted by the application.
// TODO(ccameron): Remove the need for this cast.
// https://crbug.com/888290
mojo::AssociatedInterfacePtrInfo<remote_cocoa::mojom::StubInterface>
stub_host(host.PassHandle(), 0);
remote_cocoa::mojom::StubInterfaceAssociatedRequest stub_ns_view_request(
ns_view_receiver.PassHandle());
mojo::PendingAssociatedRemote<remote_cocoa::mojom::StubInterface> stub_host(
host.PassHandle(), 0);
mojo::PendingAssociatedReceiver<remote_cocoa::mojom::StubInterface>
stub_ns_view_receiver(ns_view_receiver.PassHandle());
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());
// 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