OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_RENDERER_HOST_GTK_IM_CONTEXT_WRAPPER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_GTK_IM_CONTEXT_WRAPPER_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_GTK_IM_CONTEXT_WRAPPER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_GTK_IM_CONTEXT_WRAPPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gdk/gdk.h> | 9 #include <gdk/gdk.h> |
10 #include <pango/pango-attributes.h> | 10 #include <pango/pango-attributes.h> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 void ConfirmComposition(); | 64 void ConfirmComposition(); |
65 | 65 |
66 private: | 66 private: |
67 // For unit tests. | 67 // For unit tests. |
68 class GtkIMContextWrapperTest; | 68 class GtkIMContextWrapperTest; |
69 FRIEND_TEST_ALL_PREFIXES(GtkIMContextWrapperTest, ExtractCompositionInfo); | 69 FRIEND_TEST_ALL_PREFIXES(GtkIMContextWrapperTest, ExtractCompositionInfo); |
70 | 70 |
71 // Check if a text needs commit by forwarding a char event instead of | 71 // Check if a text needs commit by forwarding a char event instead of |
72 // by confirming as a composition text. | 72 // by confirming as a composition text. |
73 bool NeedCommitByForwardingCharEvent(); | 73 bool NeedCommitByForwardingCharEvent() const; |
| 74 |
| 75 // Check if the input method returned any result, eg. preedit and commit text. |
| 76 bool HasInputMethodResult() const; |
74 | 77 |
75 void ProcessFilteredKeyPressEvent(NativeWebKeyboardEvent* wke); | 78 void ProcessFilteredKeyPressEvent(NativeWebKeyboardEvent* wke); |
76 void ProcessUnfilteredKeyPressEvent(NativeWebKeyboardEvent* wke); | 79 void ProcessUnfilteredKeyPressEvent(NativeWebKeyboardEvent* wke); |
77 | 80 |
78 // Processes result returned from input method after filtering a key event. | 81 // Processes result returned from input method after filtering a key event. |
79 // |filtered| indicates if the key event was filtered by the input method. | 82 // |filtered| indicates if the key event was filtered by the input method. |
80 void ProcessInputMethodResult(const GdkEventKey* event, bool filtered); | 83 void ProcessInputMethodResult(const GdkEventKey* event, bool filtered); |
81 | 84 |
82 // Real code of "commit" signal handler. | 85 // Real code of "commit" signal handler. |
83 void HandleCommit(const string16& text); | 86 void HandleCommit(const string16& text); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 202 |
200 // Stores a copy of the most recent commit text received by commit signal | 203 // Stores a copy of the most recent commit text received by commit signal |
201 // handler. | 204 // handler. |
202 string16 commit_text_; | 205 string16 commit_text_; |
203 | 206 |
204 // If it's true then the next "commit" signal will be suppressed. | 207 // If it's true then the next "commit" signal will be suppressed. |
205 // It's only used to workaround http://crbug.com/50485. | 208 // It's only used to workaround http://crbug.com/50485. |
206 // TODO(suzhe): Remove it after input methods get fixed. | 209 // TODO(suzhe): Remove it after input methods get fixed. |
207 bool suppress_next_commit_; | 210 bool suppress_next_commit_; |
208 | 211 |
| 212 // Information of the last key event, for working around |
| 213 // http://crosbug.com/6582 |
| 214 int last_key_code_; |
| 215 bool last_key_was_up_; |
| 216 bool last_key_filtered_no_result_; |
| 217 |
209 DISALLOW_COPY_AND_ASSIGN(GtkIMContextWrapper); | 218 DISALLOW_COPY_AND_ASSIGN(GtkIMContextWrapper); |
210 }; | 219 }; |
211 | 220 |
212 #endif // CHROME_BROWSER_RENDERER_HOST_GTK_IM_CONTEXT_WRAPPER_H_ | 221 #endif // CHROME_BROWSER_RENDERER_HOST_GTK_IM_CONTEXT_WRAPPER_H_ |
OLD | NEW |