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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 // The caller is not allowed to delete the object. | 60 // The caller is not allowed to delete the object. |
61 internal::IBusClient* ibus_client() const; | 61 internal::IBusClient* ibus_client() const; |
62 | 62 |
63 protected: | 63 protected: |
64 // Converts |text| into CompositionText. | 64 // Converts |text| into CompositionText. |
65 void ExtractCompositionText(const chromeos::ibus::IBusText& text, | 65 void ExtractCompositionText(const chromeos::ibus::IBusText& text, |
66 uint32 cursor_position, | 66 uint32 cursor_position, |
67 CompositionText* out_composition) const; | 67 CompositionText* out_composition) const; |
68 | 68 |
69 private: | 69 private: |
70 enum InputContextState { | |
Yusuke Sato
2012/08/06 17:48:35
add comments for each enum.
Seigo Nonaka
2012/08/07 04:28:29
Done.
| |
71 INPUT_CONTEXT_STOP, | |
72 INPUT_CONTEXT_WAIT_CREATE_CREATE_INPUT_CONTEXT_RESPONSE, | |
73 INPUT_CONTEXT_RUNNING, | |
74 }; | |
70 class PendingKeyEvent; | 75 class PendingKeyEvent; |
71 class PendingCreateICRequest; | |
72 | 76 |
73 // Overridden from InputMethodBase: | 77 // Overridden from InputMethodBase: |
74 virtual void OnWillChangeFocusedClient(TextInputClient* focused_before, | 78 virtual void OnWillChangeFocusedClient(TextInputClient* focused_before, |
75 TextInputClient* focused) OVERRIDE; | 79 TextInputClient* focused) OVERRIDE; |
76 virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, | 80 virtual void OnDidChangeFocusedClient(TextInputClient* focused_before, |
77 TextInputClient* focused) OVERRIDE; | 81 TextInputClient* focused) OVERRIDE; |
78 | 82 |
79 // Creates context asynchronously. | 83 // Creates context asynchronously. |
80 void CreateContext(); | 84 void CreateContext(); |
81 | 85 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 | 157 |
154 // Event handlers for IBusInputContext: | 158 // Event handlers for IBusInputContext: |
155 void OnCommitText(const chromeos::ibus::IBusText& text); | 159 void OnCommitText(const chromeos::ibus::IBusText& text); |
156 void OnForwardKeyEvent(uint32 keyval, uint32 keycode, uint32 status); | 160 void OnForwardKeyEvent(uint32 keyval, uint32 keycode, uint32 status); |
157 void OnShowPreeditText(); | 161 void OnShowPreeditText(); |
158 void OnUpdatePreeditText(const chromeos::ibus::IBusText& text, | 162 void OnUpdatePreeditText(const chromeos::ibus::IBusText& text, |
159 uint32 cursor_pos, | 163 uint32 cursor_pos, |
160 bool visible); | 164 bool visible); |
161 void OnHidePreeditText(); | 165 void OnHidePreeditText(); |
162 | 166 |
163 void CreateInputContextDone(PendingCreateICRequest* ic_request, | 167 void CreateInputContextDone(const dbus::ObjectPath& object_path); |
164 const dbus::ObjectPath& object_path); | 168 void CreateInputContextFail(); |
165 void CreateInputContextFail(PendingCreateICRequest* ic_request); | |
166 static void ProcessKeyEventDone(PendingKeyEvent* pending_key_event, | 169 static void ProcessKeyEventDone(PendingKeyEvent* pending_key_event, |
167 bool is_handled); | 170 bool is_handled); |
168 static void ProcessKeyEventFail(PendingKeyEvent* pending_key_event); | 171 static void ProcessKeyEventFail(PendingKeyEvent* pending_key_event); |
169 | 172 |
170 scoped_ptr<internal::IBusClient> ibus_client_; | 173 scoped_ptr<internal::IBusClient> ibus_client_; |
171 | 174 |
172 // All pending key events. Note: we do not own these object, we just save | 175 // All pending key events. Note: we do not own these object, we just save |
173 // pointers to these object so that we can abandon them when necessary. | 176 // pointers to these object so that we can abandon them when necessary. |
174 // They will be deleted in ProcessKeyEventDone(). | 177 // They will be deleted in ProcessKeyEventDone(). |
175 std::set<PendingKeyEvent*> pending_key_events_; | 178 std::set<PendingKeyEvent*> pending_key_events_; |
176 | 179 |
177 // The pending request for creating the input context. We need to keep this | 180 InputContextState input_context_state_; |
Yusuke Sato
2012/08/06 17:48:35
comment
Seigo Nonaka
2012/08/07 04:28:29
Done.
| |
178 // pointer so that we can receive or abandon the result. | 181 |
179 PendingCreateICRequest* pending_create_ic_request_; | 182 int create_input_context_fail_count_; |
Yusuke Sato
2012/08/06 17:48:35
comment
Seigo Nonaka
2012/08/07 04:28:29
Done.
| |
180 | 183 |
181 // Pending composition text generated by the current pending key event. | 184 // Pending composition text generated by the current pending key event. |
182 // It'll be sent to the focused text input client as soon as we receive the | 185 // It'll be sent to the focused text input client as soon as we receive the |
183 // processing result of the pending key event. | 186 // processing result of the pending key event. |
184 CompositionText composition_; | 187 CompositionText composition_; |
185 | 188 |
186 // Pending result text generated by the current pending key event. | 189 // Pending result text generated by the current pending key event. |
187 // It'll be sent to the focused text input client as soon as we receive the | 190 // It'll be sent to the focused text input client as soon as we receive the |
188 // processing result of the pending key event. | 191 // processing result of the pending key event. |
189 string16 result_text_; | 192 string16 result_text_; |
(...skipping 19 matching lines...) Expand all Loading... | |
209 | 212 |
210 // Used for making callbacks. | 213 // Used for making callbacks. |
211 base::WeakPtrFactory<InputMethodIBus> weak_ptr_factory_; | 214 base::WeakPtrFactory<InputMethodIBus> weak_ptr_factory_; |
212 | 215 |
213 DISALLOW_COPY_AND_ASSIGN(InputMethodIBus); | 216 DISALLOW_COPY_AND_ASSIGN(InputMethodIBus); |
214 }; | 217 }; |
215 | 218 |
216 } // namespace ui | 219 } // namespace ui |
217 | 220 |
218 #endif // UI_BASE_IME_INPUT_METHOD_IBUS_H_ | 221 #endif // UI_BASE_IME_INPUT_METHOD_IBUS_H_ |
OLD | NEW |