OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_BROWSER_RENDERER_HOST_GTK_IM_CONTEXT_WRAPPER_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_GTK_IM_CONTEXT_WRAPPER_H_ | 6 #define CONTENT_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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "base/string16.h" | 15 #include "base/string16.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
17 #include "ui/base/ime/composition_text.h" | 17 #include "ui/base/ime/composition_text.h" |
18 #include "ui/base/ime/text_input_type.h" | 18 #include "ui/base/ime/text_input_type.h" |
19 | 19 |
20 namespace gfx { | 20 namespace gfx { |
21 class Rect; | 21 class Rect; |
22 } | 22 } |
23 | 23 |
24 #if !defined(TOOLKIT_VIEWS) | |
25 class MenuGtk; | |
26 #endif | |
27 class RenderWidgetHostViewGtk; | 24 class RenderWidgetHostViewGtk; |
28 struct NativeWebKeyboardEvent; | 25 struct NativeWebKeyboardEvent; |
29 typedef struct _GtkIMContext GtkIMContext; | 26 typedef struct _GtkIMContext GtkIMContext; |
30 typedef struct _GtkWidget GtkWidget; | 27 typedef struct _GtkWidget GtkWidget; |
31 | 28 |
32 // This class is a convenience wrapper for GtkIMContext. | 29 // This class is a convenience wrapper for GtkIMContext. |
33 // It creates and manages two GtkIMContext instances, one is GtkIMMulticontext, | 30 // It creates and manages two GtkIMContext instances, one is GtkIMMulticontext, |
34 // for plain text input box, another is GtkIMContextSimple, for password input | 31 // for plain text input box, another is GtkIMContextSimple, for password input |
35 // box. | 32 // box. |
36 // | 33 // |
(...skipping 14 matching lines...) Expand all Loading... |
51 void UpdateInputMethodState(ui::TextInputType type, | 48 void UpdateInputMethodState(ui::TextInputType type, |
52 bool can_compose_inline, | 49 bool can_compose_inline, |
53 const gfx::Rect& caret_rect); | 50 const gfx::Rect& caret_rect); |
54 void OnFocusIn(); | 51 void OnFocusIn(); |
55 void OnFocusOut(); | 52 void OnFocusOut(); |
56 bool is_focused() const { return is_focused_; } | 53 bool is_focused() const { return is_focused_; } |
57 | 54 |
58 #if !defined(TOOLKIT_VIEWS) | 55 #if !defined(TOOLKIT_VIEWS) |
59 // Not defined for views because the views context menu doesn't | 56 // Not defined for views because the views context menu doesn't |
60 // implement input methods yet. | 57 // implement input methods yet. |
61 void AppendInputMethodsContextMenu(MenuGtk* menu); | 58 GtkWidget* BuildInputMethodsGtkMenu(); |
62 #endif | 59 #endif |
63 | 60 |
64 void CancelComposition(); | 61 void CancelComposition(); |
65 | 62 |
66 void ConfirmComposition(); | 63 void ConfirmComposition(); |
67 | 64 |
68 private: | 65 private: |
69 // Check if a text needs commit by forwarding a char event instead of | 66 // Check if a text needs commit by forwarding a char event instead of |
70 // by confirming as a composition text. | 67 // by confirming as a composition text. |
71 bool NeedCommitByForwardingCharEvent() const; | 68 bool NeedCommitByForwardingCharEvent() const; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 187 |
191 // Information of the last key event, for working around | 188 // Information of the last key event, for working around |
192 // http://crosbug.com/6582 | 189 // http://crosbug.com/6582 |
193 int last_key_code_; | 190 int last_key_code_; |
194 bool last_key_was_up_; | 191 bool last_key_was_up_; |
195 bool last_key_filtered_no_result_; | 192 bool last_key_filtered_no_result_; |
196 | 193 |
197 DISALLOW_COPY_AND_ASSIGN(GtkIMContextWrapper); | 194 DISALLOW_COPY_AND_ASSIGN(GtkIMContextWrapper); |
198 }; | 195 }; |
199 | 196 |
200 #endif // CHROME_BROWSER_RENDERER_HOST_GTK_IM_CONTEXT_WRAPPER_H_ | 197 #endif // CONTENT_BROWSER_RENDERER_HOST_GTK_IM_CONTEXT_WRAPPER_H_ |
OLD | NEW |