| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_IBUS_H_ | 5 #ifndef UI_BASE_IME_INPUT_METHOD_IBUS_H_ |
| 6 #define UI_BASE_IME_INPUT_METHOD_IBUS_H_ | 6 #define UI_BASE_IME_INPUT_METHOD_IBUS_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 virtual void OnConnected() OVERRIDE; | 57 virtual void OnConnected() OVERRIDE; |
| 58 virtual void OnDisconnected() OVERRIDE; | 58 virtual void OnDisconnected() OVERRIDE; |
| 59 | 59 |
| 60 // Converts |text| into CompositionText. | 60 // Converts |text| into CompositionText. |
| 61 void ExtractCompositionText(const chromeos::IBusText& text, | 61 void ExtractCompositionText(const chromeos::IBusText& text, |
| 62 uint32 cursor_position, | 62 uint32 cursor_position, |
| 63 CompositionText* out_composition) const; | 63 CompositionText* out_composition) const; |
| 64 | 64 |
| 65 // Process a key returned from the input method. | 65 // Process a key returned from the input method. |
| 66 virtual void ProcessKeyEventPostIME(const base::NativeEvent& native_key_event, | 66 virtual void ProcessKeyEventPostIME(const base::NativeEvent& native_key_event, |
| 67 uint32 ibus_keyval, |
| 67 uint32 ibus_keycode, | 68 uint32 ibus_keycode, |
| 69 uint32 ibus_state, |
| 68 bool handled); | 70 bool handled); |
| 69 | 71 |
| 70 // Converts |native_event| to ibus representation. | 72 // Converts |native_event| to ibus representation. |
| 71 virtual void IBusKeyEventFromNativeKeyEvent( | 73 virtual void IBusKeyEventFromNativeKeyEvent( |
| 72 const base::NativeEvent& native_event, | 74 const base::NativeEvent& native_event, |
| 73 uint32* ibus_keyval, | 75 uint32* ibus_keyval, |
| 74 uint32* ibus_keycode, | 76 uint32* ibus_keycode, |
| 75 uint32* ibus_state); | 77 uint32* ibus_state); |
| 76 | 78 |
| 77 // Resets context and abandon all pending results and key events. | 79 // Resets context and abandon all pending results and key events. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // Checks the availability of focused text input client and update focus | 112 // Checks the availability of focused text input client and update focus |
| 111 // state. | 113 // state. |
| 112 void UpdateContextFocusState(); | 114 void UpdateContextFocusState(); |
| 113 | 115 |
| 114 // Processes a key event that was already filtered by the input method. | 116 // Processes a key event that was already filtered by the input method. |
| 115 // A VKEY_PROCESSKEY may be dispatched to the focused View. | 117 // A VKEY_PROCESSKEY may be dispatched to the focused View. |
| 116 void ProcessFilteredKeyPressEvent(const base::NativeEvent& native_key_event); | 118 void ProcessFilteredKeyPressEvent(const base::NativeEvent& native_key_event); |
| 117 | 119 |
| 118 // Processes a key event that was not filtered by the input method. | 120 // Processes a key event that was not filtered by the input method. |
| 119 void ProcessUnfilteredKeyPressEvent(const base::NativeEvent& native_key_event, | 121 void ProcessUnfilteredKeyPressEvent(const base::NativeEvent& native_key_event, |
| 120 uint32 ibus_keycode); | 122 uint32 ibus_keyval, |
| 123 uint32 ibus_keycode, |
| 124 uint32 ibus_state); |
| 121 void ProcessUnfilteredFabricatedKeyPressEvent(EventType type, | 125 void ProcessUnfilteredFabricatedKeyPressEvent(EventType type, |
| 122 KeyboardCode key_code, | 126 KeyboardCode key_code, |
| 123 int flags, | 127 int event_flags, |
| 124 uint32 ibus_keyval); | 128 uint32 ibus_keyval, |
| 129 uint32 ibus_keycode); |
| 125 | 130 |
| 126 // Processes an unfiltered key press event with character composer. | 131 // Processes an unfiltered key press event with character composer. |
| 127 // This method returns true if the key press is filtered by the composer. | 132 // This method returns true if the key press is filtered by the composer. |
| 128 bool ProcessUnfilteredKeyPressEventWithCharacterComposer(uint32 ibus_keyval, | 133 bool ProcessUnfilteredKeyPressEventWithCharacterComposer(uint32 ibus_keyval, |
| 129 uint32 state); | 134 uint32 ibus_keycode, |
| 135 int event_flags); |
| 130 | 136 |
| 131 // Sends input method result caused by the given key event to the focused text | 137 // Sends input method result caused by the given key event to the focused text |
| 132 // input client. | 138 // input client. |
| 133 void ProcessInputMethodResult(const base::NativeEvent& native_key_event, | 139 void ProcessInputMethodResult(const base::NativeEvent& native_key_event, |
| 134 bool filtered); | 140 bool filtered); |
| 135 | 141 |
| 136 // Checks if the pending input method result needs inserting into the focused | 142 // Checks if the pending input method result needs inserting into the focused |
| 137 // text input client as a single character. | 143 // text input client as a single character. |
| 138 bool NeedInsertChar() const; | 144 bool NeedInsertChar() const; |
| 139 | 145 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 155 // Returns true if the connection to ibus-daemon is established. | 161 // Returns true if the connection to ibus-daemon is established. |
| 156 bool IsConnected(); | 162 bool IsConnected(); |
| 157 | 163 |
| 158 // Returns true if the input context is ready to use. | 164 // Returns true if the input context is ready to use. |
| 159 bool IsContextReady(); | 165 bool IsContextReady(); |
| 160 | 166 |
| 161 // chromeos::IBusInputContextHandlerInterface overrides: | 167 // chromeos::IBusInputContextHandlerInterface overrides: |
| 162 virtual void CommitText(const chromeos::IBusText& text) OVERRIDE; | 168 virtual void CommitText(const chromeos::IBusText& text) OVERRIDE; |
| 163 virtual void ForwardKeyEvent(uint32 keyval, | 169 virtual void ForwardKeyEvent(uint32 keyval, |
| 164 uint32 keycode, | 170 uint32 keycode, |
| 165 uint32 status) OVERRIDE; | 171 uint32 state) OVERRIDE; |
| 166 virtual void ShowPreeditText() OVERRIDE; | 172 virtual void ShowPreeditText() OVERRIDE; |
| 167 virtual void HidePreeditText() OVERRIDE; | 173 virtual void HidePreeditText() OVERRIDE; |
| 168 virtual void UpdatePreeditText(const chromeos::IBusText& text, | 174 virtual void UpdatePreeditText(const chromeos::IBusText& text, |
| 169 uint32 cursor_pos, | 175 uint32 cursor_pos, |
| 170 bool visible) OVERRIDE; | 176 bool visible) OVERRIDE; |
| 171 virtual void DeleteSurroundingText(int32 offset, uint32 length) OVERRIDE; | 177 virtual void DeleteSurroundingText(int32 offset, uint32 length) OVERRIDE; |
| 172 | 178 |
| 173 void CreateInputContextDone(const dbus::ObjectPath& object_path); | 179 void CreateInputContextDone(const dbus::ObjectPath& object_path); |
| 174 void CreateInputContextFail(); | 180 void CreateInputContextFail(); |
| 175 void ProcessKeyEventDone(uint32 id, XEvent* xevent, uint32 keyval, | 181 void ProcessKeyEventDone(uint32 id, XEvent* xevent, |
| 176 bool is_handled); | 182 uint32 ibus_keyval, uint32 ibus_keycode, |
| 183 uint32 ibus_state, bool is_handled); |
| 177 | 184 |
| 178 // All pending key events. Note: we do not own these object, we just save | 185 // All pending key events. Note: we do not own these object, we just save |
| 179 // pointers to these object so that we can abandon them when necessary. | 186 // pointers to these object so that we can abandon them when necessary. |
| 180 // They will be deleted in ProcessKeyEventDone(). | 187 // They will be deleted in ProcessKeyEventDone(). |
| 181 std::set<uint32> pending_key_events_; | 188 std::set<uint32> pending_key_events_; |
| 182 | 189 |
| 183 // Represents input context's state. | 190 // Represents input context's state. |
| 184 InputContextState input_context_state_; | 191 InputContextState input_context_state_; |
| 185 | 192 |
| 186 // The count of CreateInputContext message failure. | 193 // The count of CreateInputContext message failure. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 228 |
| 222 // Used for making callbacks. | 229 // Used for making callbacks. |
| 223 base::WeakPtrFactory<InputMethodIBus> weak_ptr_factory_; | 230 base::WeakPtrFactory<InputMethodIBus> weak_ptr_factory_; |
| 224 | 231 |
| 225 DISALLOW_COPY_AND_ASSIGN(InputMethodIBus); | 232 DISALLOW_COPY_AND_ASSIGN(InputMethodIBus); |
| 226 }; | 233 }; |
| 227 | 234 |
| 228 } // namespace ui | 235 } // namespace ui |
| 229 | 236 |
| 230 #endif // UI_BASE_IME_INPUT_METHOD_IBUS_H_ | 237 #endif // UI_BASE_IME_INPUT_METHOD_IBUS_H_ |
| OLD | NEW |