Commit b664d732 authored by Shu Chen's avatar Shu Chen Committed by Commit Bot

Remove ime.mojom and the code on the client side for Mojo-based IMF.

Bug: 965908
Change-Id: I83aec36d10247ef7dd08ef58a04f0f2362a8d495
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1626053Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Shu Chen <shuchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662925}
parent 6eb61402
...@@ -50,8 +50,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) InputMethodChromeOS ...@@ -50,8 +50,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) InputMethodChromeOS
InputMethodKeyboardController* GetInputMethodKeyboardController() override; InputMethodKeyboardController* GetInputMethodKeyboardController() override;
// Overridden from InputMethodBase: // Overridden from InputMethodBase:
void OnFocus() override;
void OnBlur() override;
void OnWillChangeFocusedClient(TextInputClient* focused_before, void OnWillChangeFocusedClient(TextInputClient* focused_before,
TextInputClient* focused) override; TextInputClient* focused) override;
void OnDidChangeFocusedClient(TextInputClient* focused_before, void OnDidChangeFocusedClient(TextInputClient* focused_before,
...@@ -79,7 +77,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) InputMethodChromeOS ...@@ -79,7 +77,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) InputMethodChromeOS
void ResetContext(); void ResetContext();
private: private:
class MojoHelper;
class PendingKeyEvent; class PendingKeyEvent;
friend TestableInputMethodChromeOS; friend TestableInputMethodChromeOS;
...@@ -204,8 +201,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) InputMethodChromeOS ...@@ -204,8 +201,6 @@ class COMPONENT_EXPORT(UI_BASE_IME_CHROMEOS) InputMethodChromeOS
// This is used in CommitText/UpdateCompositionText/etc. // This is used in CommitText/UpdateCompositionText/etc.
bool handling_key_event_; bool handling_key_event_;
std::unique_ptr<MojoHelper> mojo_helper_;
// Used for making callbacks. // Used for making callbacks.
base::WeakPtrFactory<InputMethodChromeOS> weak_ptr_factory_; base::WeakPtrFactory<InputMethodChromeOS> weak_ptr_factory_;
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/test/bind_test_util.h" #include "base/test/bind_test_util.h"
#include "base/test/scoped_task_environment.h" #include "base/test/scoped_task_environment.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ime/chromeos/mock_ime_candidate_window_handler.h" #include "ui/base/ime/chromeos/mock_ime_candidate_window_handler.h"
...@@ -27,7 +26,6 @@ ...@@ -27,7 +26,6 @@
#include "ui/base/ime/ime_bridge.h" #include "ui/base/ime/ime_bridge.h"
#include "ui/base/ime/ime_engine_handler_interface.h" #include "ui/base/ime/ime_engine_handler_interface.h"
#include "ui/base/ime/input_method_delegate.h" #include "ui/base/ime/input_method_delegate.h"
#include "ui/base/ime/mojo/ime.mojom.h"
#include "ui/base/ime/text_input_client.h" #include "ui/base/ime/text_input_client.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
...@@ -234,53 +232,6 @@ class CachingInputMethodDelegate : public internal::InputMethodDelegate { ...@@ -234,53 +232,6 @@ class CachingInputMethodDelegate : public internal::InputMethodDelegate {
DISALLOW_COPY_AND_ASSIGN(CachingInputMethodDelegate); DISALLOW_COPY_AND_ASSIGN(CachingInputMethodDelegate);
}; };
class MojoInputMethodDelegate : public ui::internal::InputMethodDelegate,
public ime::mojom::ImeEngine {
public:
MojoInputMethodDelegate() : engine_binding_(this) {}
~MojoInputMethodDelegate() override = default;
ime::mojom::ImeEngineClientProxy* engine_client() const {
return engine_client_.get();
}
void FlushForTesting() { engine_client_.FlushForTesting(); }
private:
// Overridden from ui::internal::InputMethodDelegate:
ui::EventDispatchDetails DispatchKeyEventPostIME(
ui::KeyEvent* event,
DispatchKeyEventPostIMECallback callback) override {
event->StopPropagation();
RunDispatchKeyEventPostIMECallback(event, std::move(callback));
return ui::EventDispatchDetails();
}
bool ConnectToImeEngine(ime::mojom::ImeEngineRequest engine_request,
ime::mojom::ImeEngineClientPtr client) override {
engine_binding_.Bind(std::move(engine_request));
engine_client_ = std::move(client);
return true;
}
// ime::mojom::ImeEngine:
void StartInput(ime::mojom::EditorInfoPtr info) override {}
void FinishInput() override {}
void CancelInput() override {}
void ProcessKeyEvent(std::unique_ptr<ui::Event> key_event,
ProcessKeyEventCallback callback) override {}
void UpdateSurroundingInfo(const std::string& text,
int32_t cursor,
int32_t anchor,
int32_t offset) override {}
void UpdateCompositionBounds(const std::vector<gfx::Rect>& bounds) override {}
mojo::Binding<ime::mojom::ImeEngine> engine_binding_;
ime::mojom::ImeEngineClientPtr engine_client_;
DISALLOW_COPY_AND_ASSIGN(MojoInputMethodDelegate);
};
class InputMethodChromeOSTest : public internal::InputMethodDelegate, class InputMethodChromeOSTest : public internal::InputMethodDelegate,
public testing::Test, public testing::Test,
public DummyTextInputClient { public DummyTextInputClient {
...@@ -970,15 +921,6 @@ TEST_F(InputMethodChromeOSTest, SurroundingText_EventOrder) { ...@@ -970,15 +921,6 @@ TEST_F(InputMethodChromeOSTest, SurroundingText_EventOrder) {
IMEBridge::Get()->SetCurrentEngineHandler(nullptr); IMEBridge::Get()->SetCurrentEngineHandler(nullptr);
} }
TEST_F(InputMethodChromeOSTest, MojoInteractions) {
MojoInputMethodDelegate delegate;
TestableInputMethodChromeOS im(&delegate);
im.OnFocus();
delegate.engine_client()->CommitText("test");
delegate.FlushForTesting();
EXPECT_EQ("test", im.text_committed());
}
class InputMethodChromeOSKeyEventTest : public InputMethodChromeOSTest { class InputMethodChromeOSKeyEventTest : public InputMethodChromeOSTest {
public: public:
InputMethodChromeOSKeyEventTest() {} InputMethodChromeOSKeyEventTest() {}
......
...@@ -6,7 +6,6 @@ import("//mojo/public/tools/bindings/mojom.gni") ...@@ -6,7 +6,6 @@ import("//mojo/public/tools/bindings/mojom.gni")
mojom("mojo") { mojom("mojo") {
sources = [ sources = [
"ime.mojom",
"ime_types.mojom", "ime_types.mojom",
] ]
......
// Copyright 2019 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.
module ime.mojom;
import "ui/base/ime/mojo/ime_types.mojom";
import "ui/events/mojo/event.mojom";
import "ui/gfx/geometry/mojo/geometry.mojom";
// The data of the text input field for the IME.
// It is passed from the client to the IME through StartInput method.
struct EditorInfo {
ui.mojom.TextInputType type;
ui.mojom.TextInputMode mode;
int32 flags;
ui.mojom.FocusReason focus_reason;
bool should_do_learning;
};
// Represents the IME (a.k.a. input-method engine).
// The client uses this interface to communicate with the IME.
interface ImeEngine {
// This method is called when the app starts to receive text (e.g. an input
// field is focused) and it is ready for this ImeEngine to process received
// events and send result text back to the app.
StartInput(EditorInfo info);
// This method is called when the app stops to receive text (e.g. the focused
// input field lost the focus). The ImeEngine usually handles this to reset
// its internal states.
FinishInput();
// This method is called when the app wants to cancel the ongoing composition.
CancelInput();
// Dispatches a key event to this ImeEngine, which will respond with a boolean
// value of true means the key event is handled and false unhandled.
// If the key event is handled, the app should NOT apply its default behaviors
// (e.g. shortcuts, generate text, etc.).
ProcessKeyEvent(ui.mojom.Event key_event) => (bool handled);
// Called when a new surrounding text is set by the app.
// The |text| is the surrounding text and |cursor| is 0 based index of cursor
// position in |text|. If there is selection range, |anchor| represents
// opposite index from |cursor|. Otherwise |anchor| is equal to |cursor|.
// If not all surrounding text is given |offset| indicates the starting
// offset of |text|.
UpdateSurroundingInfo(string text, int32 cursor, int32 anchor, int32 offset);
// Called when the composition bounds in screen changes.
// The composition bounds can be changed when ImeEngine changes composition or
// the text field's coordinates is changed by the app.
UpdateCompositionBounds(array<gfx.mojom.Rect> bounds);
};
// Used by |ImeEngine| to communicate state back to the client.
// The app should generate the corresponding results to the input field:
// - immediately if didn't dispatch a key event to IME;
// (e.g. by IME's on-screen keyboard)
// - later after the IME responds the |ProcessKeyEvent| with the result;
interface ImeEngineClient {
// Called when the IME wants to insert the |text| to the input field.
CommitText(string text);
// Called when the IME wants to generate/update the composition text to the
// input field.
UpdateCompositionText(ui.mojom.CompositionText composition_text,
uint32 cursor_pos,
bool visible);
// Called when the IME wants to remove a piece of text in the input field.
DeleteSurroundingText(int32 offset, uint32 length);
// Called when the IME wants to silumate a physical key event to the app.
// Usually this is for on-screen keyboard support (e.g. simulate Enter key).
SendKeyEvent(ui.mojom.Event key_event);
// Called when the ImeEngine is deactivated and this client should reconnect
// for the new active ImeEngine.
Reconnect();
};
// Implemented by the IME.
// An IME should implement both ImeEngine and ImeEngineFactory interfaces.
// The |ImeEngineFactoryRegistry| calls |CreateEngine| to make the ImeEngine
// and ImeEngineClient can hold each other.
interface ImeEngineFactory {
CreateEngine(ImeEngine& engine_request, ImeEngineClient client);
};
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