| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 UI_KEYBOARD_WEBUI_VK_MOJO_HANDLER_H_ | 5 #ifndef UI_KEYBOARD_WEBUI_VK_MOJO_HANDLER_H_ |
| 6 #define UI_KEYBOARD_WEBUI_VK_MOJO_HANDLER_H_ | 6 #define UI_KEYBOARD_WEBUI_VK_MOJO_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "mojo/public/cpp/bindings/binding.h" |
| 9 #include "ui/base/ime/input_method_observer.h" | 10 #include "ui/base/ime/input_method_observer.h" |
| 10 #include "ui/keyboard/webui/keyboard.mojom.h" | 11 #include "ui/keyboard/webui/keyboard.mojom.h" |
| 11 | 12 |
| 12 namespace keyboard { | 13 namespace keyboard { |
| 13 | 14 |
| 14 class VKMojoHandler : public mojo::InterfaceImpl<KeyboardUIHandlerMojo>, | 15 class VKMojoHandler : public KeyboardUIHandlerMojo, |
| 15 public ui::InputMethodObserver { | 16 public ui::InputMethodObserver { |
| 16 public: | 17 public: |
| 17 VKMojoHandler(); | 18 explicit VKMojoHandler(mojo::InterfaceRequest<KeyboardUIHandlerMojo> request); |
| 18 ~VKMojoHandler() override; | 19 ~VKMojoHandler() override; |
| 19 | 20 |
| 20 private: | 21 private: |
| 21 ui::InputMethod* GetInputMethod(); | 22 ui::InputMethod* GetInputMethod(); |
| 22 | 23 |
| 23 // mojo::InterfaceImpl<>: | |
| 24 void OnConnectionEstablished() override; | |
| 25 | |
| 26 // KeyboardUIHandlerMojo: | 24 // KeyboardUIHandlerMojo: |
| 27 void SendKeyEvent(const mojo::String& event_type, | 25 void SendKeyEvent(const mojo::String& event_type, |
| 28 int32_t char_value, | 26 int32_t char_value, |
| 29 int32_t key_code, | 27 int32_t key_code, |
| 30 const mojo::String& key_name, | 28 const mojo::String& key_name, |
| 31 int32_t modifiers) override; | 29 int32_t modifiers) override; |
| 32 void HideKeyboard() override; | 30 void HideKeyboard() override; |
| 33 | 31 |
| 34 // ui::InputMethodObserver: | 32 // ui::InputMethodObserver: |
| 35 void OnTextInputTypeChanged(const ui::TextInputClient* client) override; | 33 void OnTextInputTypeChanged(const ui::TextInputClient* client) override; |
| 36 void OnFocus() override; | 34 void OnFocus() override; |
| 37 void OnBlur() override; | 35 void OnBlur() override; |
| 38 void OnCaretBoundsChanged(const ui::TextInputClient* client) override; | 36 void OnCaretBoundsChanged(const ui::TextInputClient* client) override; |
| 39 void OnTextInputStateChanged(const ui::TextInputClient* text_client) override; | 37 void OnTextInputStateChanged(const ui::TextInputClient* text_client) override; |
| 40 void OnInputMethodDestroyed(const ui::InputMethod* input_method) override; | 38 void OnInputMethodDestroyed(const ui::InputMethod* input_method) override; |
| 41 void OnShowImeIfNeeded() override; | 39 void OnShowImeIfNeeded() override; |
| 42 | 40 |
| 41 mojo::Binding<KeyboardUIHandlerMojo> binding_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(VKMojoHandler); | 43 DISALLOW_COPY_AND_ASSIGN(VKMojoHandler); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 } // namespace keyboard | 46 } // namespace keyboard |
| 47 | 47 |
| 48 #endif // UI_KEYBOARD_WEBUI_VK_MOJO_HANDLER_H_ | 48 #endif // UI_KEYBOARD_WEBUI_VK_MOJO_HANDLER_H_ |
| OLD | NEW |