Commit 4938fc0d authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

Convert mojom::TextInputHost to new Mojo types

It converts TextInputHost from text_input_host.mojom to new
Mojo types using PendingAssociatedReceiver, AssociatedReceiver,
PendingAssociatedRemote, and AssociatedRemote.

Bug: 955171
Change-Id: I39b94453e0bbfe6bf713cdad8cc288347d49a736
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1893607
Commit-Queue: Julie Kim <jkim@igalia.com>
Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarccameron <ccameron@chromium.org>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712054}
parent 6532435a
...@@ -53,7 +53,8 @@ class REMOTE_COCOA_APP_SHIM_EXPORT ApplicationBridge ...@@ -53,7 +53,8 @@ class REMOTE_COCOA_APP_SHIM_EXPORT ApplicationBridge
mojo::PendingAssociatedReceiver<mojom::NativeWidgetNSWindow> mojo::PendingAssociatedReceiver<mojom::NativeWidgetNSWindow>
bridge_receiver, bridge_receiver,
mojo::PendingAssociatedRemote<mojom::NativeWidgetNSWindowHost> host, mojo::PendingAssociatedRemote<mojom::NativeWidgetNSWindowHost> host,
mojom::TextInputHostAssociatedPtrInfo text_input_host) override; mojo::PendingAssociatedRemote<mojom::TextInputHost> text_input_host)
override;
void CreateRenderWidgetHostNSView( void CreateRenderWidgetHostNSView(
mojom::StubInterfaceAssociatedPtrInfo host, mojom::StubInterfaceAssociatedPtrInfo host,
mojom::StubInterfaceAssociatedRequest view_request) override; mojom::StubInterfaceAssociatedRequest view_request) override;
......
...@@ -27,13 +27,15 @@ class NativeWidgetBridgeOwner : public NativeWidgetNSWindowHostHelper { ...@@ -27,13 +27,15 @@ class NativeWidgetBridgeOwner : public NativeWidgetNSWindowHostHelper {
bridge_receiver, bridge_receiver,
mojo::PendingAssociatedRemote<mojom::NativeWidgetNSWindowHost> mojo::PendingAssociatedRemote<mojom::NativeWidgetNSWindowHost>
host_remote, host_remote,
mojom::TextInputHostAssociatedPtrInfo text_input_host_ptr) { mojo::PendingAssociatedRemote<mojom::TextInputHost>
text_input_host_remote) {
host_remote_.Bind(std::move(host_remote), host_remote_.Bind(std::move(host_remote),
ui::WindowResizeHelperMac::Get()->task_runner()); ui::WindowResizeHelperMac::Get()->task_runner());
text_input_host_ptr_.Bind(std::move(text_input_host_ptr), text_input_host_remote_.Bind(
std::move(text_input_host_remote),
ui::WindowResizeHelperMac::Get()->task_runner()); ui::WindowResizeHelperMac::Get()->task_runner());
bridge_ = std::make_unique<NativeWidgetNSWindowBridge>( bridge_ = std::make_unique<NativeWidgetNSWindowBridge>(
bridge_id, host_remote_.get(), this, text_input_host_ptr_.get()); bridge_id, host_remote_.get(), this, text_input_host_remote_.get());
bridge_->BindReceiver( bridge_->BindReceiver(
std::move(bridge_receiver), std::move(bridge_receiver),
base::BindOnce(&NativeWidgetBridgeOwner::OnMojoDisconnect, base::BindOnce(&NativeWidgetBridgeOwner::OnMojoDisconnect,
...@@ -91,7 +93,7 @@ class NativeWidgetBridgeOwner : public NativeWidgetNSWindowHostHelper { ...@@ -91,7 +93,7 @@ class NativeWidgetBridgeOwner : public NativeWidgetNSWindowHostHelper {
} }
mojo::AssociatedRemote<mojom::NativeWidgetNSWindowHost> host_remote_; mojo::AssociatedRemote<mojom::NativeWidgetNSWindowHost> host_remote_;
mojom::TextInputHostAssociatedPtr text_input_host_ptr_; mojo::AssociatedRemote<mojom::TextInputHost> text_input_host_remote_;
std::unique_ptr<NativeWidgetNSWindowBridge> bridge_; std::unique_ptr<NativeWidgetNSWindowBridge> bridge_;
base::scoped_nsobject<NSAccessibilityRemoteUIElement> base::scoped_nsobject<NSAccessibilityRemoteUIElement>
...@@ -137,7 +139,7 @@ void ApplicationBridge::CreateNativeWidgetNSWindow( ...@@ -137,7 +139,7 @@ void ApplicationBridge::CreateNativeWidgetNSWindow(
mojo::PendingAssociatedReceiver<mojom::NativeWidgetNSWindow> mojo::PendingAssociatedReceiver<mojom::NativeWidgetNSWindow>
bridge_receiver, bridge_receiver,
mojo::PendingAssociatedRemote<mojom::NativeWidgetNSWindowHost> host, mojo::PendingAssociatedRemote<mojom::NativeWidgetNSWindowHost> host,
mojom::TextInputHostAssociatedPtrInfo text_input_host) { mojo::PendingAssociatedRemote<mojom::TextInputHost> text_input_host) {
// The resulting object will be destroyed when its message pipe is closed. // The resulting object will be destroyed when its message pipe is closed.
ignore_result( ignore_result(
new NativeWidgetBridgeOwner(bridge_id, std::move(bridge_receiver), new NativeWidgetBridgeOwner(bridge_id, std::move(bridge_receiver),
......
...@@ -39,7 +39,7 @@ interface Application { ...@@ -39,7 +39,7 @@ interface Application {
uint64 bridge_id, uint64 bridge_id,
pending_associated_receiver<NativeWidgetNSWindow> window_receiver, pending_associated_receiver<NativeWidgetNSWindow> window_receiver,
pending_associated_remote<NativeWidgetNSWindowHost> host, pending_associated_remote<NativeWidgetNSWindowHost> host,
associated TextInputHost text_input_host); pending_associated_remote<TextInputHost> text_input_host);
// 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.
......
...@@ -350,13 +350,15 @@ void NativeWidgetMacNSWindowHost::CreateRemoteNSWindow( ...@@ -350,13 +350,15 @@ void NativeWidgetMacNSWindowHost::CreateRemoteNSWindow(
// Initialize |remote_ns_window_remote_| to point to a bridge created by // Initialize |remote_ns_window_remote_| to point to a bridge created by
// |factory|. // |factory|.
remote_cocoa::mojom::TextInputHostAssociatedPtr text_input_host_ptr; mojo::PendingAssociatedRemote<remote_cocoa::mojom::TextInputHost>
text_input_host_->BindRequest(mojo::MakeRequest(&text_input_host_ptr)); text_input_host_remote;
text_input_host_->BindReceiver(
text_input_host_remote.InitWithNewEndpointAndPassReceiver());
application_host_->GetApplication()->CreateNativeWidgetNSWindow( application_host_->GetApplication()->CreateNativeWidgetNSWindow(
widget_id_, remote_ns_window_remote_.BindNewEndpointAndPassReceiver(), widget_id_, remote_ns_window_remote_.BindNewEndpointAndPassReceiver(),
remote_ns_window_host_receiver_.BindNewEndpointAndPassRemote( remote_ns_window_host_receiver_.BindNewEndpointAndPassRemote(
ui::WindowResizeHelperMac::Get()->task_runner()), ui::WindowResizeHelperMac::Get()->task_runner()),
text_input_host_ptr.PassInterface()); std::move(text_input_host_remote));
// Create the window in its process, and attach it to its parent window. // Create the window in its process, and attach it to its parent window.
GetNSWindowMojo()->CreateWindow(std::move(window_create_params)); GetNSWindowMojo()->CreateWindow(std::move(window_create_params));
......
...@@ -7,7 +7,8 @@ ...@@ -7,7 +7,8 @@
#include "base/macros.h" #include "base/macros.h"
#include "components/remote_cocoa/common/text_input_host.mojom.h" #include "components/remote_cocoa/common/text_input_host.mojom.h"
#include "mojo/public/cpp/bindings/associated_binding.h" #include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "ui/views/views_export.h" #include "ui/views/views_export.h"
namespace ui { namespace ui {
...@@ -22,7 +23,9 @@ class VIEWS_EXPORT TextInputHost : public remote_cocoa::mojom::TextInputHost { ...@@ -22,7 +23,9 @@ class VIEWS_EXPORT TextInputHost : public remote_cocoa::mojom::TextInputHost {
public: public:
explicit TextInputHost(NativeWidgetMacNSWindowHost* host_impl); explicit TextInputHost(NativeWidgetMacNSWindowHost* host_impl);
~TextInputHost() override; ~TextInputHost() override;
void BindRequest(remote_cocoa::mojom::TextInputHostAssociatedRequest request); void BindReceiver(
mojo::PendingAssociatedReceiver<remote_cocoa::mojom::TextInputHost>
receiver);
// Set the current TextInputClient. // Set the current TextInputClient.
void SetTextInputClient(ui::TextInputClient* new_text_input_client); void SetTextInputClient(ui::TextInputClient* new_text_input_client);
...@@ -80,7 +83,8 @@ class VIEWS_EXPORT TextInputHost : public remote_cocoa::mojom::TextInputHost { ...@@ -80,7 +83,8 @@ class VIEWS_EXPORT TextInputHost : public remote_cocoa::mojom::TextInputHost {
NativeWidgetMacNSWindowHost* const host_impl_; NativeWidgetMacNSWindowHost* const host_impl_;
mojo::AssociatedBinding<remote_cocoa::mojom::TextInputHost> mojo_binding_; mojo::AssociatedReceiver<remote_cocoa::mojom::TextInputHost> mojo_receiver_{
this};
DISALLOW_COPY_AND_ASSIGN(TextInputHost); DISALLOW_COPY_AND_ASSIGN(TextInputHost);
}; };
......
...@@ -132,13 +132,14 @@ namespace views { ...@@ -132,13 +132,14 @@ namespace views {
// TextInputHost, public: // TextInputHost, public:
TextInputHost::TextInputHost(NativeWidgetMacNSWindowHost* host_impl) TextInputHost::TextInputHost(NativeWidgetMacNSWindowHost* host_impl)
: host_impl_(host_impl), mojo_binding_(this) {} : host_impl_(host_impl) {}
TextInputHost::~TextInputHost() = default; TextInputHost::~TextInputHost() = default;
void TextInputHost::BindRequest( void TextInputHost::BindReceiver(
remote_cocoa::mojom::TextInputHostAssociatedRequest request) { mojo::PendingAssociatedReceiver<remote_cocoa::mojom::TextInputHost>
mojo_binding_.Bind(std::move(request), receiver) {
mojo_receiver_.Bind(std::move(receiver),
ui::WindowResizeHelperMac::Get()->task_runner()); ui::WindowResizeHelperMac::Get()->task_runner());
} }
......
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