Commit 27e69a44 authored by erg's avatar erg Committed by Commit bot

Revert of IME for Mus: Make InputMethodMus use the IME Mojo API. (patchset #16...

Revert of IME for Mus: Make InputMethodMus use the IME Mojo API. (patchset #16 id:300001 of https://codereview.chromium.org/2230393002/ )

Reason for revert:
All text input appears to be broken in chrome on mash, and I bisected to this patch. Reverting locally appears to fix this.

Original issue's description:
> IME for Mus: Make InputMethodMus use the IME Mojo API.
>
> This CL:
> * Uses Mus' IMEServer to do the IME logic in InputMethodMus.
> * Adds unittests to test InputMethodMus.
> * Starts test_ime_driver on mus+ash session startup.
> * Modifies test_ime_driver to not-handle non character events.
>
> BUG=548407
>
> Committed: https://crrev.com/aa4f90ab72b60fd90e048b1e18193c30f0462d77
> Cr-Commit-Position: refs/heads/master@{#414748}

TBR=sadrul@chromium.org,sky@chromium.org,tsepez@chromium.org,moshayedi@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=548407

Review-Url: https://codereview.chromium.org/2284003002
Cr-Commit-Position: refs/heads/master@{#414803}
parent 9ea5dcb4
......@@ -4,7 +4,6 @@
#include "services/ui/ime/ime_server_impl.h"
#include "services/shell/public/cpp/connector.h"
#include "services/ui/ime/ime_registrar_impl.h"
namespace ui {
......@@ -13,12 +12,6 @@ IMEServerImpl::IMEServerImpl() : current_id_(0) {}
IMEServerImpl::~IMEServerImpl() {}
void IMEServerImpl::Init(shell::Connector* connector) {
// TODO(moshayedi): crbug.com/641041. Look up the driver from the mojo:catalog
// service.
connector->Connect("mojo:test_ime_driver");
}
void IMEServerImpl::AddBinding(mojom::IMEServerRequest request) {
bindings_.AddBinding(this, std::move(request));
}
......
......@@ -10,10 +10,6 @@
#include "mojo/public/cpp/bindings/binding_set.h"
#include "services/ui/public/interfaces/ime.mojom.h"
namespace shell {
class Connector;
}
namespace ui {
class IMEServerImpl : public mojom::IMEServer {
......@@ -21,7 +17,6 @@ class IMEServerImpl : public mojom::IMEServer {
IMEServerImpl();
~IMEServerImpl() override;
void Init(shell::Connector* connector);
void AddBinding(mojom::IMEServerRequest request);
void OnDriverChanged(mojom::IMEDriverPtr driver);
......
......@@ -18,7 +18,7 @@ class TestTextInputClient : public ui::mojom::TextInputClient {
explicit TestTextInputClient(ui::mojom::TextInputClientRequest request)
: binding_(this, std::move(request)) {}
ui::mojom::CompositionEventPtr WaitUntilCompositionEvent() {
ui::mojom::CompositionEventPtr ReceiveCompositionEvent() {
run_loop_.reset(new base::RunLoop);
run_loop_->Run();
run_loop_.reset();
......@@ -26,28 +26,15 @@ class TestTextInputClient : public ui::mojom::TextInputClient {
return std::move(receieved_composition_event_);
}
ui::Event* WaitUntilUnhandledEvent() {
run_loop_.reset(new base::RunLoop);
run_loop_->Run();
run_loop_.reset();
return unhandled_event_.get();
}
private:
void OnCompositionEvent(ui::mojom::CompositionEventPtr event) override {
receieved_composition_event_ = std::move(event);
run_loop_->Quit();
}
void OnUnhandledEvent(std::unique_ptr<ui::Event> char_event) override {
unhandled_event_ = std::move(char_event);
run_loop_->Quit();
}
mojo::Binding<ui::mojom::TextInputClient> binding_;
std::unique_ptr<base::RunLoop> run_loop_;
ui::mojom::CompositionEventPtr receieved_composition_event_;
std::unique_ptr<ui::Event> unhandled_event_;
DISALLOW_COPY_AND_ASSIGN(TestTextInputClient);
};
......@@ -80,32 +67,19 @@ TEST_F(IMEAppTest, ProcessKeyEvent) {
ui::mojom::InputMethodPtr input_method;
ime_server_->StartSession(std::move(client_ptr), GetProxy(&input_method));
// Send character key event.
ui::KeyEvent char_event('A', ui::VKEY_A, 0);
input_method->ProcessKeyEvent(ui::Event::Clone(char_event));
ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0);
input_method->ProcessKeyEvent(ui::Event::Clone(key_event));
ui::mojom::CompositionEventPtr composition_event =
client.WaitUntilCompositionEvent();
EXPECT_EQ(ui::mojom::CompositionEventType::INSERT_CHAR,
client.ReceiveCompositionEvent();
ASSERT_EQ(ui::mojom::CompositionEventType::INSERT_CHAR,
composition_event->type);
EXPECT_TRUE(composition_event->key_event);
EXPECT_TRUE(composition_event->key_event.value()->IsKeyEvent());
ASSERT_TRUE(composition_event->key_event);
ASSERT_TRUE(composition_event->key_event.value()->IsKeyEvent());
ui::KeyEvent* received_key_event =
composition_event->key_event.value()->AsKeyEvent();
EXPECT_EQ(ui::ET_KEY_PRESSED, received_key_event->type());
EXPECT_TRUE(received_key_event->is_char());
EXPECT_EQ(char_event.GetCharacter(), received_key_event->GetCharacter());
// Send non-character key event.
ui::KeyEvent nonchar_event(ui::ET_KEY_PRESSED, ui::VKEY_LEFT, 0);
input_method->ProcessKeyEvent(ui::Event::Clone(nonchar_event));
ui::Event* unhandled_event = client.WaitUntilUnhandledEvent();
EXPECT_TRUE(unhandled_event);
EXPECT_TRUE(unhandled_event->IsKeyEvent());
EXPECT_FALSE(unhandled_event->AsKeyEvent()->is_char());
EXPECT_EQ(ui::ET_KEY_PRESSED, unhandled_event->type());
EXPECT_EQ(nonchar_event.key_code(),
unhandled_event->AsKeyEvent()->key_code());
ASSERT_EQ(ui::ET_KEY_PRESSED, received_key_event->type());
ASSERT_EQ(key_event.GetCharacter(), received_key_event->GetCharacter());
}
......@@ -18,10 +18,6 @@ class TestIME : public shell::Service {
private:
// shell::Service:
bool OnConnect(const shell::Identity& remote_identity,
shell::InterfaceRegistry* registry) override {
return true;
}
void OnStart(const shell::Identity& identity) override {
mojom::IMEDriverPtr ime_driver_ptr;
new TestIMEDriver(GetProxy(&ime_driver_ptr));
......
......@@ -22,16 +22,12 @@ class TestInputMethod : public mojom::InputMethod {
void OnCaretBoundsChanged(const gfx::Rect& caret_bounds) override {}
void ProcessKeyEvent(std::unique_ptr<Event> key_event) override {
DCHECK(key_event->IsKeyEvent());
mojom::CompositionEventPtr composition_event =
mojom::CompositionEvent::New();
composition_event->type = mojom::CompositionEventType::INSERT_CHAR;
composition_event->key_event = std::move(key_event);
if (key_event->AsKeyEvent()->is_char()) {
mojom::CompositionEventPtr composition_event =
mojom::CompositionEvent::New();
composition_event->type = mojom::CompositionEventType::INSERT_CHAR;
composition_event->key_event = std::move(key_event);
client_->OnCompositionEvent(std::move(composition_event));
} else {
client_->OnUnhandledEvent(std::move(key_event));
}
client_->OnCompositionEvent(std::move(composition_event));
};
void CancelComposition() override {}
......
......@@ -93,24 +93,15 @@ interface InputMethod {
// Mus translates it to global coordinates and sends it to IME app.
OnCaretBoundsChanged(gfx.mojom.Rect caret_bounds);
// Called to process a key event. If InputMethod handles the event, it will
// notify the client of the resulting composition events (there might be none)
// by calling TextInputClient::OnCompositionEvent(). If the event is not
// handled by InputMethod, TextInputClient::OnUnhandledEvent() is called.
ProcessKeyEvent(ui.mojom.Event key_event);
CancelComposition();
};
// IME drivers send updates to clients using the TextInputClient interface.
interface TextInputClient {
// Corresponds to "input method result" functions of ui::TextInputClient.
// See comments for InputMethod::ProcessKeyEvent() for when this is called.
OnCompositionEvent(CompositionEvent event);
// See comments for InputMethod::ProcessKeyEvent() for when this is called.
OnUnhandledEvent(ui.mojom.Event key_event);
// TODO(moshayedi): Add functions corresponding to ui::TextInputClient for:
// - Input text confirmation
// - Document content operations
......
......@@ -188,8 +188,6 @@ void Service::OnStart(const shell::Identity& identity) {
if (ui::DeviceDataManager::HasInstance())
touch_controller_.reset(
new ws::TouchController(window_server_->display_manager()));
ime_server_.Init(connector());
}
bool Service::OnConnect(const shell::Identity& remote_identity,
......
......@@ -37,8 +37,6 @@ component("mus") {
"screen_mus_delegate.h",
"surface_context_factory.cc",
"surface_context_factory.h",
"text_input_client_impl.cc",
"text_input_client_impl.h",
"window_manager_connection.cc",
"window_manager_connection.h",
"window_manager_constants_converters.cc",
......@@ -157,7 +155,6 @@ test("views_mus_unittests") {
sources = [
"display_list_unittest.cc",
"input_method_mus_unittest.cc",
"native_widget_mus_unittest.cc",
"os_exchange_data_provider_mus_unittest.cc",
"pointer_watcher_event_router_unittest.cc",
......@@ -222,7 +219,6 @@ test("views_mus_unittests") {
data_deps = [
":unittests_manifest",
"//services/ui/ime/test_ime_driver",
"//services/ui/test_wm",
]
......
......@@ -7,51 +7,43 @@
#include <utility>
#include "services/ui/public/cpp/window.h"
#include "services/ui/public/interfaces/ime.mojom.h"
#include "ui/base/ime/text_input_client.h"
#include "ui/events/event.h"
#include "ui/platform_window/mojo/ime_type_converters.h"
#include "ui/platform_window/mojo/text_input_state.mojom.h"
#include "ui/views/mus/text_input_client_impl.h"
namespace views {
////////////////////////////////////////////////////////////////////////////////
// InputMethodMus, public:
// InputMethodMUS, public:
InputMethodMus::InputMethodMus(ui::internal::InputMethodDelegate* delegate,
InputMethodMUS::InputMethodMUS(ui::internal::InputMethodDelegate* delegate,
ui::Window* window)
: window_(window) {
SetDelegate(delegate);
}
InputMethodMus::~InputMethodMus() {}
void InputMethodMus::Init(shell::Connector* connector) {
connector->ConnectToInterface("mojo:ui", &ime_server_);
}
InputMethodMUS::~InputMethodMUS() {}
////////////////////////////////////////////////////////////////////////////////
// InputMethodMus, ui::InputMethod implementation:
// InputMethodMUS, ui::InputMethod implementation:
void InputMethodMus::OnFocus() {
void InputMethodMUS::OnFocus() {
InputMethodBase::OnFocus();
UpdateTextInputType();
}
void InputMethodMus::OnBlur() {
void InputMethodMUS::OnBlur() {
InputMethodBase::OnBlur();
UpdateTextInputType();
}
bool InputMethodMus::OnUntranslatedIMEMessage(const base::NativeEvent& event,
bool InputMethodMUS::OnUntranslatedIMEMessage(const base::NativeEvent& event,
NativeEventResult* result) {
// This method is not called on non-Windows platforms. See the comments for
// ui::InputMethod::OnUntranslatedIMEMessage().
return false;
}
void InputMethodMus::DispatchKeyEvent(ui::KeyEvent* event) {
void InputMethodMUS::DispatchKeyEvent(ui::KeyEvent* event) {
DCHECK(event->type() == ui::ET_KEY_PRESSED ||
event->type() == ui::ET_KEY_RELEASED);
......@@ -61,14 +53,12 @@ void InputMethodMus::DispatchKeyEvent(ui::KeyEvent* event) {
return;
}
// TODO(moshayedi): crbug.com/641355. Currently if we stop propagation of
// non-char events here, accelerators ddn't work. This is because we send the
// event ack too early in NativeWidgetMus. We should send both char and
// non-char events to the IME driver once we fix this.
// Here is where we change the differ from our base class's logic. Instead of
// always dispatching a key down event, and then sending a synthesized
// character event, we instead check to see if this is a character event and
// send out the key if it is. (We fallback to normal dispatch if it isn't.)
if (event->is_char()) {
// IME driver will notify the text input client if it is not interested in
// event, which in turn will call DispatchKeyEventPostIME().
input_method_->ProcessKeyEvent(ui::Event::Clone(*event));
GetTextInputClient()->InsertChar(*event);
event->StopPropagation();
return;
}
......@@ -76,65 +66,41 @@ void InputMethodMus::DispatchKeyEvent(ui::KeyEvent* event) {
ignore_result(DispatchKeyEventPostIME(event));
}
void InputMethodMus::OnTextInputTypeChanged(const ui::TextInputClient* client) {
void InputMethodMUS::OnTextInputTypeChanged(const ui::TextInputClient* client) {
if (IsTextInputClientFocused(client))
UpdateTextInputType();
InputMethodBase::OnTextInputTypeChanged(client);
if (input_method_) {
input_method_->OnTextInputTypeChanged(
static_cast<ui::mojom::TextInputType>(client->GetTextInputType()));
}
}
void InputMethodMus::OnCaretBoundsChanged(const ui::TextInputClient* client) {
if (input_method_)
input_method_->OnCaretBoundsChanged(client->GetCaretBounds());
}
void InputMethodMUS::OnCaretBoundsChanged(const ui::TextInputClient* client) {}
void InputMethodMus::CancelComposition(const ui::TextInputClient* client) {
if (input_method_)
input_method_->CancelComposition();
}
void InputMethodMUS::CancelComposition(const ui::TextInputClient* client) {}
void InputMethodMus::OnInputLocaleChanged() {
// TODO(moshayedi): crbug.com/637418. Not supported in ChromeOS. Investigate
// whether we want to support this or not.
}
void InputMethodMUS::OnInputLocaleChanged() {}
std::string InputMethodMus::GetInputLocale() {
// TODO(moshayedi): crbug.com/637418. Not supported in ChromeOS. Investigate
// whether we want to support this or not.
return std::string();
std::string InputMethodMUS::GetInputLocale() {
return "";
}
bool InputMethodMus::IsCandidatePopupOpen() const {
// TODO(moshayedi): crbug.com/637416. Implement this properly when we have a
// mean for displaying candidate list popup.
bool InputMethodMUS::IsCandidatePopupOpen() const {
return false;
}
void InputMethodMus::OnDidChangeFocusedClient(
void InputMethodMUS::OnDidChangeFocusedClient(
ui::TextInputClient* focused_before,
ui::TextInputClient* focused) {
InputMethodBase::OnDidChangeFocusedClient(focused_before, focused);
UpdateTextInputType();
text_input_client_.reset(new TextInputClientImpl(focused, this));
ime_server_->StartSession(text_input_client_->CreateInterfacePtrAndBind(),
GetProxy(&input_method_));
}
void InputMethodMus::UpdateTextInputType() {
void InputMethodMUS::UpdateTextInputType() {
ui::TextInputType type = GetTextInputType();
mojo::TextInputStatePtr state = mojo::TextInputState::New();
state->type = mojo::ConvertTo<mojo::TextInputType>(type);
if (window_) {
if (type != ui::TEXT_INPUT_TYPE_NONE)
window_->SetImeVisibility(true, std::move(state));
else
window_->SetTextInputState(std::move(state));
}
if (type != ui::TEXT_INPUT_TYPE_NONE)
window_->SetImeVisibility(true, std::move(state));
else
window_->SetTextInputState(std::move(state));
}
} // namespace views
......@@ -8,9 +8,6 @@
#define UI_VIEWS_MUS_INPUT_METHOD_MUS_H_
#include "base/macros.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "services/shell/public/cpp/connector.h"
#include "services/ui/public/interfaces/ime.mojom.h"
#include "ui/views/mus/mus_export.h"
namespace ui {
......@@ -19,16 +16,13 @@ class Window;
namespace views {
class TextInputClientImpl;
class VIEWS_MUS_EXPORT InputMethodMus : public ui::InputMethodBase {
class VIEWS_MUS_EXPORT InputMethodMUS : public ui::InputMethodBase {
public:
InputMethodMus(ui::internal::InputMethodDelegate* delegate,
InputMethodMUS(ui::internal::InputMethodDelegate* delegate,
ui::Window* window);
~InputMethodMus() override;
void Init(shell::Connector* connector);
~InputMethodMUS() override;
private:
// Overridden from ui::InputMethod:
void OnFocus() override;
void OnBlur() override;
......@@ -42,24 +36,16 @@ class VIEWS_MUS_EXPORT InputMethodMus : public ui::InputMethodBase {
std::string GetInputLocale() override;
bool IsCandidatePopupOpen() const override;
private:
friend TextInputClientImpl;
// Overridden from ui::InputMethodBase:
void OnDidChangeFocusedClient(ui::TextInputClient* focused_before,
ui::TextInputClient* focused) override;
void UpdateTextInputType();
// The toplevel window which is not owned by this class. This may be null
// for tests.
// The toplevel window which is not owned by this class.
ui::Window* window_;
ui::mojom::IMEServerPtr ime_server_;
ui::mojom::InputMethodPtr input_method_;
std::unique_ptr<TextInputClientImpl> text_input_client_;
DISALLOW_COPY_AND_ASSIGN(InputMethodMus);
DISALLOW_COPY_AND_ASSIGN(InputMethodMUS);
};
} // namespace views
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/views/mus/input_method_mus.h"
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ime/dummy_text_input_client.h"
#include "ui/base/ime/input_method_delegate.h"
#include "ui/events/event.h"
#include "ui/views/mus/window_manager_connection.h"
#include "ui/views/test/scoped_views_test_helper.h"
namespace views {
namespace {
class TestInputMethodDelegate : public ui::internal::InputMethodDelegate {
public:
TestInputMethodDelegate() {}
~TestInputMethodDelegate() override {}
// ui::internal::InputMethodDelegate:
ui::EventDispatchDetails DispatchKeyEventPostIME(
ui::KeyEvent* key_event) override {
return ui::EventDispatchDetails();
}
private:
DISALLOW_COPY_AND_ASSIGN(TestInputMethodDelegate);
};
class TestTextInputClient : public ui::DummyTextInputClient {
public:
TestTextInputClient() {}
~TestTextInputClient() override {}
ui::KeyEvent* WaitUntilInputReceieved() {
run_loop_.reset(new base::RunLoop);
run_loop_->Run();
run_loop_.reset();
return received_event_->AsKeyEvent();
}
// ui::DummyTextInputClient:
void InsertChar(const ui::KeyEvent& event) override {
received_event_ = ui::Event::Clone(event);
run_loop_->Quit();
}
private:
std::unique_ptr<base::RunLoop> run_loop_;
std::unique_ptr<ui::Event> received_event_;
DISALLOW_COPY_AND_ASSIGN(TestTextInputClient);
};
} // namespace
class InputMethodMusTest : public testing::Test {
public:
InputMethodMusTest() : message_loop_(base::MessageLoop::TYPE_UI) {}
~InputMethodMusTest() override {}
shell::Connector* connector() {
return WindowManagerConnection::Get()->connector();
}
private:
base::MessageLoop message_loop_;
ScopedViewsTestHelper helper_;
DISALLOW_COPY_AND_ASSIGN(InputMethodMusTest);
};
TEST_F(InputMethodMusTest, DispatchKeyEvent) {
// test_ime_driver will register itself as the current IMEDriver. It echoes
// back the character key events it receives.
EXPECT_TRUE(connector()->Connect("mojo:test_ime_driver"));
TestInputMethodDelegate input_method_delegate;
InputMethodMus input_method(&input_method_delegate, nullptr);
input_method.Init(connector());
TestTextInputClient text_input_client;
input_method.SetFocusedTextInputClient(&text_input_client);
ui::KeyEvent key_event('A', ui::VKEY_A, 0);
input_method.DispatchKeyEvent(&key_event);
ui::KeyEvent* received_event = text_input_client.WaitUntilInputReceieved();
EXPECT_EQ(ui::ET_KEY_PRESSED, received_event->type());
EXPECT_TRUE(received_event->is_char());
EXPECT_EQ(key_event.GetCharacter(), received_event->GetCharacter());
}
} // namespace views
......@@ -32,7 +32,6 @@
#include "ui/gfx/path.h"
#include "ui/native_theme/native_theme_aura.h"
#include "ui/platform_window/platform_window_delegate.h"
#include "ui/views/mus/window_manager_connection.h"
#include "ui/views/mus/window_manager_constants_converters.h"
#include "ui/views/mus/window_manager_frame_values.h"
#include "ui/views/mus/window_tree_host_mus.h"
......@@ -688,13 +687,6 @@ void NativeWidgetMus::InitNativeWidget(const Widget::InitParams& params) {
window_tree_host_->InitHost();
hosted_window->SetProperty(kMusWindow, window_);
// TODO(moshayedi): crbug.com/641039. Investigate whether there are any cases
// where we need input method but don't have the WindowManagerConnection here.
if (WindowManagerConnection::Exists()) {
window_tree_host_->InitInputMethod(
WindowManagerConnection::Get()->connector());
}
focus_client_.reset(
new FocusControllerMus(new FocusRulesImpl(hosted_window)));
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/views/mus/text_input_client_impl.h"
#include "ui/base/ime/text_input_client.h"
#include "ui/views/mus/input_method_mus.h"
namespace views {
TextInputClientImpl::TextInputClientImpl(ui::TextInputClient* text_input_client,
InputMethodMus* input_method)
: text_input_client_(text_input_client),
input_method_(input_method),
binding_(this) {}
TextInputClientImpl::~TextInputClientImpl() {}
ui::mojom::TextInputClientPtr TextInputClientImpl::CreateInterfacePtrAndBind() {
return binding_.CreateInterfacePtrAndBind();
}
void TextInputClientImpl::OnCompositionEvent(
ui::mojom::CompositionEventPtr event) {
switch (event->type) {
case ui::mojom::CompositionEventType::INSERT_CHAR: {
DCHECK((*event->key_event)->IsKeyEvent());
ui::KeyEvent* key_event = (*event->key_event)->AsKeyEvent();
DCHECK(key_event->is_char());
text_input_client_->InsertChar(*key_event);
break;
}
case ui::mojom::CompositionEventType::CONFIRM:
text_input_client_->ConfirmCompositionText();
break;
case ui::mojom::CompositionEventType::CLEAR:
text_input_client_->ClearCompositionText();
break;
case ui::mojom::CompositionEventType::UPDATE:
case ui::mojom::CompositionEventType::INSERT_TEXT:
// TODO(moshayedi): crbug.com/631524. Implement these types of composition
// events once we have the necessary fields in ui.mojom.CompositionEvent.
NOTIMPLEMENTED();
break;
}
}
void TextInputClientImpl::OnUnhandledEvent(
std::unique_ptr<ui::Event> key_event) {
DCHECK(key_event && key_event->IsKeyEvent());
input_method_->DispatchKeyEventPostIME(key_event->AsKeyEvent());
}
} // namespace views
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_VIEWS_MUS_TEXT_INPUT_CLIENT_IMPL_H_
#define UI_VIEWS_MUS_TEXT_INPUT_CLIENT_IMPL_H_
#include "mojo/public/cpp/bindings/binding.h"
#include "services/ui/public/interfaces/ime.mojom.h"
namespace ui {
class TextInputClient;
}
namespace views {
class InputMethodMus;
// TextInputClientImpl receieves updates from IME drivers over Mojo IPC, and
// notifies the underlying ui::TextInputClient accordingly.
class TextInputClientImpl : public ui::mojom::TextInputClient {
public:
TextInputClientImpl(ui::TextInputClient* text_input_client,
InputMethodMus* input_method);
~TextInputClientImpl() override;
ui::mojom::TextInputClientPtr CreateInterfacePtrAndBind();
private:
// ui::mojom::TextInputClient:
void OnCompositionEvent(ui::mojom::CompositionEventPtr event) override;
void OnUnhandledEvent(std::unique_ptr<ui::Event> key_event) override;
ui::TextInputClient* text_input_client_;
InputMethodMus* input_method_;
mojo::Binding<ui::mojom::TextInputClient> binding_;
DISALLOW_COPY_AND_ASSIGN(TextInputClientImpl);
};
} // namespace views
#endif // UI_VIEWS_MUS_TEXT_INPUT_CLIENT_IMPL_H_
......@@ -54,7 +54,7 @@ WindowTreeHostMus::WindowTreeHostMus(NativeWidgetMus* native_widget,
dispatcher()->set_transform_events(false);
compositor()->SetHostHasTransparentBackground(true);
input_method_.reset(new InputMethodMus(this, window));
input_method_.reset(new InputMethodMUS(this, window));
SetSharedInputMethod(input_method_.get());
}
......@@ -63,10 +63,6 @@ WindowTreeHostMus::~WindowTreeHostMus() {
DestroyDispatcher();
}
void WindowTreeHostMus::InitInputMethod(shell::Connector* connector) {
input_method_->Init(connector);
}
void WindowTreeHostMus::DispatchEvent(ui::Event* event) {
if (event->IsKeyEvent() && GetInputMethod()) {
GetInputMethod()->DispatchKeyEvent(event->AsKeyEvent());
......
......@@ -6,7 +6,6 @@
#define UI_VIEWS_MUS_WINDOW_TREE_HOST_MUS_H_
#include "base/macros.h"
#include "services/shell/public/cpp/connector.h"
#include "ui/aura/window_tree_host_platform.h"
#include "ui/views/mus/mus_export.h"
......@@ -22,7 +21,7 @@ class Connector;
namespace views {
class InputMethodMus;
class InputMethodMUS;
class NativeWidgetMus;
class PlatformWindowMus;
......@@ -32,8 +31,6 @@ class VIEWS_MUS_EXPORT WindowTreeHostMus : public aura::WindowTreeHostPlatform {
~WindowTreeHostMus() override;
NativeWidgetMus* native_widget() { return native_widget_; }
void InitInputMethod(shell::Connector* connector);
private:
// aura::WindowTreeHostPlatform:
void DispatchEvent(ui::Event* event) override;
......@@ -42,7 +39,7 @@ class VIEWS_MUS_EXPORT WindowTreeHostMus : public aura::WindowTreeHostPlatform {
void OnCloseRequest() override;
NativeWidgetMus* native_widget_;
std::unique_ptr<InputMethodMus> input_method_;
std::unique_ptr<InputMethodMUS> input_method_;
DISALLOW_COPY_AND_ASSIGN(WindowTreeHostMus);
};
......
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