| Index: chrome/browser/ui/views/ime_driver/ime_driver_mus.cc
|
| diff --git a/chrome/browser/ui/views/ime_driver_mus.cc b/chrome/browser/ui/views/ime_driver/ime_driver_mus.cc
|
| similarity index 54%
|
| rename from chrome/browser/ui/views/ime_driver_mus.cc
|
| rename to chrome/browser/ui/views/ime_driver/ime_driver_mus.cc
|
| index 2b618861a76850d9b05fd1729cbd5b9c099ef529..1a29b6b95b0fe222071fb3fa382787daf4d20be2 100644
|
| --- a/chrome/browser/ui/views/ime_driver_mus.cc
|
| +++ b/chrome/browser/ui/views/ime_driver/ime_driver_mus.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/browser/ui/views/ime_driver_mus.h"
|
| +#include "chrome/browser/ui/views/ime_driver/ime_driver_mus.h"
|
|
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/common/service_manager_connection.h"
|
| @@ -10,43 +10,13 @@
|
| #include "services/service_manager/public/cpp/connector.h"
|
| #include "services/ui/public/interfaces/constants.mojom.h"
|
| #include "services/ui/public/interfaces/ime/ime.mojom.h"
|
| +#include "ui/base/ime/ime_bridge.h"
|
|
|
| -namespace {
|
| -
|
| -class InputMethod : public ui::mojom::InputMethod {
|
| - public:
|
| - explicit InputMethod(ui::mojom::TextInputClientPtr client)
|
| - : client_(std::move(client)) {}
|
| - ~InputMethod() override {}
|
| -
|
| - private:
|
| - // ui::mojom::InputMethod:
|
| - void OnTextInputModeChanged(
|
| - ui::mojom::TextInputMode text_input_mode) override {}
|
| - void OnTextInputTypeChanged(
|
| - ui::mojom::TextInputType text_input_type) override {}
|
| - void OnCaretBoundsChanged(const gfx::Rect& caret_bounds) override {}
|
| - void ProcessKeyEvent(std::unique_ptr<ui::Event> key_event,
|
| - const ProcessKeyEventCallback& callback) override {
|
| - DCHECK(key_event->IsKeyEvent());
|
| -
|
| - if (key_event->AsKeyEvent()->is_char()) {
|
| - client_->InsertChar(std::move(key_event));
|
| - callback.Run(true);
|
| - } else {
|
| - callback.Run(false);
|
| - }
|
| - }
|
| - void CancelComposition() override {}
|
| -
|
| - ui::mojom::TextInputClientPtr client_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(InputMethod);
|
| -};
|
| -
|
| -} // namespace
|
| -
|
| -IMEDriver::~IMEDriver() {}
|
| +#if defined(OS_CHROMEOS)
|
| +#include "chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos.h"
|
| +#else
|
| +#include "chrome/browser/ui/views/ime_driver/noop_input_method.h"
|
| +#endif // defined(OS_CHROMEOS)
|
|
|
| // static
|
| void IMEDriver::Register() {
|
| @@ -61,17 +31,28 @@ void IMEDriver::Register() {
|
| ime_registrar->RegisterDriver(std::move(ime_driver_ptr));
|
| }
|
|
|
| +IMEDriver::~IMEDriver() {}
|
| +
|
| +IMEDriver::IMEDriver() {
|
| + ui::IMEBridge::Initialize();
|
| +}
|
| +
|
| void IMEDriver::StartSession(
|
| int32_t session_id,
|
| ui::mojom::TextInputClientPtr client,
|
| ui::mojom::InputMethodRequest input_method_request) {
|
| +#if defined(OS_CHROMEOS)
|
| input_method_bindings_[session_id] =
|
| base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>(
|
| - new InputMethod(std::move(client)), std::move(input_method_request));
|
| + new InputMethodBridge(std::move(client)),
|
| + std::move(input_method_request));
|
| +#else
|
| + input_method_bindings_[session_id] =
|
| + base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>(
|
| + new NoOpInputMethod());
|
| +#endif
|
| }
|
|
|
| -IMEDriver::IMEDriver() {}
|
| -
|
| void IMEDriver::CancelSession(int32_t session_id) {
|
| input_method_bindings_.erase(session_id);
|
| }
|
|
|