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_BASE_IME_INPUT_METHOD_CHROMEOS_H_ | 5 #ifndef UI_BASE_IME_INPUT_METHOD_CHROMEOS_H_ |
6 #define UI_BASE_IME_INPUT_METHOD_CHROMEOS_H_ | 6 #define UI_BASE_IME_INPUT_METHOD_CHROMEOS_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "ui/base/ime/chromeos/character_composer.h" | 17 #include "ui/base/ime/chromeos/character_composer.h" |
18 #include "ui/base/ime/composition_text.h" | 18 #include "ui/base/ime/composition_text.h" |
19 #include "ui/base/ime/ime_input_context_handler_interface.h" | 19 #include "ui/base/ime/ime_input_context_handler_interface.h" |
20 #include "ui/base/ime/input_method_base.h" | 20 #include "ui/base/ime/input_method_base.h" |
21 | 21 |
22 namespace ui { | 22 namespace ui { |
23 | 23 |
24 // A ui::InputMethod implementation based on IBus. | 24 // A ui::InputMethod implementation based on IBus. |
25 class UI_BASE_IME_EXPORT InputMethodChromeOS : public InputMethodBase { | 25 class UI_BASE_IME_EXPORT InputMethodChromeOS : public InputMethodBase { |
26 public: | 26 public: |
27 explicit InputMethodChromeOS(internal::InputMethodDelegate* delegate); | 27 explicit InputMethodChromeOS(internal::InputMethodDelegate* delegate); |
28 ~InputMethodChromeOS() override; | 28 ~InputMethodChromeOS() override; |
29 | 29 |
| 30 using AckCallback = base::Callback<void(bool)>; |
| 31 void DispatchKeyEvent(ui::KeyEvent* event, |
| 32 std::unique_ptr<AckCallback> ack_callback); |
| 33 |
30 // Overridden from InputMethod: | 34 // Overridden from InputMethod: |
31 bool OnUntranslatedIMEMessage(const base::NativeEvent& event, | 35 bool OnUntranslatedIMEMessage(const base::NativeEvent& event, |
32 NativeEventResult* result) override; | 36 NativeEventResult* result) override; |
33 void DispatchKeyEvent(ui::KeyEvent* event) override; | 37 void DispatchKeyEvent(ui::KeyEvent* event) override; |
34 void OnTextInputTypeChanged(const TextInputClient* client) override; | 38 void OnTextInputTypeChanged(const TextInputClient* client) override; |
35 void OnCaretBoundsChanged(const TextInputClient* client) override; | 39 void OnCaretBoundsChanged(const TextInputClient* client) override; |
36 void CancelComposition(const TextInputClient* client) override; | 40 void CancelComposition(const TextInputClient* client) override; |
37 bool IsCandidatePopupOpen() const override; | 41 bool IsCandidatePopupOpen() const override; |
38 | 42 |
39 protected: | 43 protected: |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 void CommitText(const std::string& text) override; | 97 void CommitText(const std::string& text) override; |
94 void UpdateCompositionText(const CompositionText& text, | 98 void UpdateCompositionText(const CompositionText& text, |
95 uint32_t cursor_pos, | 99 uint32_t cursor_pos, |
96 bool visible) override; | 100 bool visible) override; |
97 void DeleteSurroundingText(int32_t offset, uint32_t length) override; | 101 void DeleteSurroundingText(int32_t offset, uint32_t length) override; |
98 | 102 |
99 // Hides the composition text. | 103 // Hides the composition text. |
100 void HidePreeditText(); | 104 void HidePreeditText(); |
101 | 105 |
102 // Callback function for IMEEngineHandlerInterface::ProcessKeyEvent. | 106 // Callback function for IMEEngineHandlerInterface::ProcessKeyEvent. |
103 void ProcessKeyEventDone(ui::KeyEvent* event, bool is_handled); | 107 void ProcessKeyEventDone(ui::KeyEvent* event, |
| 108 std::unique_ptr<AckCallback> ack_callback, |
| 109 bool is_handled); |
104 | 110 |
105 // Returns whether an non-password input field is focused. | 111 // Returns whether an non-password input field is focused. |
106 bool IsNonPasswordInputFieldFocused(); | 112 bool IsNonPasswordInputFieldFocused(); |
107 | 113 |
108 // Returns true if an text input field is focused. | 114 // Returns true if an text input field is focused. |
109 bool IsInputFieldFocused(); | 115 bool IsInputFieldFocused(); |
110 | 116 |
111 // Pending composition text generated by the current pending key event. | 117 // Pending composition text generated by the current pending key event. |
112 // It'll be sent to the focused text input client as soon as we receive the | 118 // It'll be sent to the focused text input client as soon as we receive the |
113 // processing result of the pending key event. | 119 // processing result of the pending key event. |
(...skipping 23 matching lines...) Expand all Loading... |
137 | 143 |
138 // Used for making callbacks. | 144 // Used for making callbacks. |
139 base::WeakPtrFactory<InputMethodChromeOS> weak_ptr_factory_; | 145 base::WeakPtrFactory<InputMethodChromeOS> weak_ptr_factory_; |
140 | 146 |
141 DISALLOW_COPY_AND_ASSIGN(InputMethodChromeOS); | 147 DISALLOW_COPY_AND_ASSIGN(InputMethodChromeOS); |
142 }; | 148 }; |
143 | 149 |
144 } // namespace ui | 150 } // namespace ui |
145 | 151 |
146 #endif // UI_BASE_IME_INPUT_METHOD_CHROMEOS_H_ | 152 #endif // UI_BASE_IME_INPUT_METHOD_CHROMEOS_H_ |
OLD | NEW |