| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_IME_DRIVER_INPUT_METHOD_BRIDGE_CHROMEOS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_IME_DRIVER_INPUT_METHOD_BRIDGE_CHROMEOS_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_IME_DRIVER_INPUT_METHOD_BRIDGE_CHROMEOS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_IME_DRIVER_INPUT_METHOD_BRIDGE_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/ui/views/ime_driver/remote_text_input_client.h" |
| 8 #include "services/ui/public/interfaces/ime/ime.mojom.h" | 9 #include "services/ui/public/interfaces/ime/ime.mojom.h" |
| 9 #include "ui/base/ime/input_method_chromeos.h" | 10 #include "ui/base/ime/input_method_chromeos.h" |
| 10 | 11 |
| 11 // This bridges between mojo InputMethod API and ui::InputMethodChromeOS. It | 12 // This bridges between mojo InputMethod API and ui::InputMethodChromeOS. It |
| 12 // forwards the received events to an instance of ui::InputMethodChromeOS. | 13 // forwards the received events to an instance of ui::InputMethodChromeOS. |
| 13 class InputMethodBridge : public ui::mojom::InputMethod { | 14 class InputMethodBridge : public ui::mojom::InputMethod { |
| 14 public: | 15 public: |
| 15 explicit InputMethodBridge(ui::mojom::TextInputClientPtr client); | 16 explicit InputMethodBridge(std::unique_ptr<RemoteTextInputClient> client); |
| 16 ~InputMethodBridge() override; | 17 ~InputMethodBridge() override; |
| 17 | 18 |
| 18 // ui::mojom::InputMethod: | 19 // ui::mojom::InputMethod: |
| 19 void OnTextInputModeChanged(ui::TextInputMode text_input_mode) override; | 20 void OnTextInputModeChanged(ui::TextInputMode text_input_mode) override; |
| 20 void OnTextInputTypeChanged(ui::TextInputType text_input_type) override; | 21 void OnTextInputTypeChanged(ui::TextInputType text_input_type) override; |
| 21 void OnCaretBoundsChanged(const gfx::Rect& caret_bounds) override; | 22 void OnCaretBoundsChanged(const gfx::Rect& caret_bounds) override; |
| 22 void ProcessKeyEvent(std::unique_ptr<ui::Event> key_event, | 23 void ProcessKeyEvent(std::unique_ptr<ui::Event> key_event, |
| 23 const ProcessKeyEventCallback& callback) override; | 24 const ProcessKeyEventCallback& callback) override; |
| 24 void CancelComposition() override; | 25 void CancelComposition() override; |
| 25 | 26 |
| 26 private: | 27 private: |
| 27 std::unique_ptr<ui::TextInputClient> client_; | 28 std::unique_ptr<RemoteTextInputClient> client_; |
| 28 std::unique_ptr<ui::InputMethodChromeOS> input_method_chromeos_; | 29 std::unique_ptr<ui::InputMethodChromeOS> input_method_chromeos_; |
| 29 | 30 |
| 30 DISALLOW_COPY_AND_ASSIGN(InputMethodBridge); | 31 DISALLOW_COPY_AND_ASSIGN(InputMethodBridge); |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 #endif // CHROME_BROWSER_UI_VIEWS_IME_DRIVER_INPUT_METHOD_BRIDGE_CHROMEOS_H_ | 34 #endif // CHROME_BROWSER_UI_VIEWS_IME_DRIVER_INPUT_METHOD_BRIDGE_CHROMEOS_H_ |
| OLD | NEW |