OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_RENDER_WIDGET_HOST_VIEW_GTK_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ |
7 | 7 |
8 #include <gdk/gdk.h> | 8 #include <gdk/gdk.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/gfx/native_widget_types.h" | 11 #include "base/gfx/native_widget_types.h" |
| 12 #include "base/scoped_ptr.h" |
12 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 13 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
13 #include "chrome/common/owned_widget_gtk.h" | 14 #include "chrome/common/owned_widget_gtk.h" |
14 #include "chrome/common/render_messages.h" | 15 #include "chrome/common/render_messages.h" |
15 #include "webkit/glue/plugins/gtk_plugin_container_manager.h" | 16 #include "webkit/glue/plugins/gtk_plugin_container_manager.h" |
16 #include "webkit/glue/webcursor.h" | 17 #include "webkit/glue/webcursor.h" |
17 | 18 |
18 class RenderWidgetHost; | 19 class RenderWidgetHost; |
| 20 // A conveience wrapper class for GtkIMContext; |
| 21 class RenderWidgetHostViewGtkIMContext; |
19 | 22 |
20 typedef struct _GtkClipboard GtkClipboard; | 23 typedef struct _GtkClipboard GtkClipboard; |
21 typedef struct _GtkSelectionData GtkSelectionData; | 24 typedef struct _GtkSelectionData GtkSelectionData; |
22 typedef struct _GtkIMContext GtkIMContext; | 25 typedef struct _GtkIMContext GtkIMContext; |
23 | 26 |
24 // ----------------------------------------------------------------------------- | 27 // ----------------------------------------------------------------------------- |
25 // See comments in render_widget_host_view.h about this class and its members. | 28 // See comments in render_widget_host_view.h about this class and its members. |
26 // ----------------------------------------------------------------------------- | 29 // ----------------------------------------------------------------------------- |
27 class RenderWidgetHostViewGtk : public RenderWidgetHostView { | 30 class RenderWidgetHostViewGtk : public RenderWidgetHostView { |
28 public: | 31 public: |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // Variables used only for popups -------------------------------------------- | 112 // Variables used only for popups -------------------------------------------- |
110 // Our parent widget. | 113 // Our parent widget. |
111 RenderWidgetHostView* parent_host_view_; | 114 RenderWidgetHostView* parent_host_view_; |
112 // The native view of our parent, equivalent to | 115 // The native view of our parent, equivalent to |
113 // parent_host_view_->GetNativeView(). | 116 // parent_host_view_->GetNativeView(). |
114 GtkWidget* parent_; | 117 GtkWidget* parent_; |
115 // We ignore the first mouse release on popups. This allows the popup to | 118 // We ignore the first mouse release on popups. This allows the popup to |
116 // stay open. | 119 // stay open. |
117 bool is_popup_first_mouse_release_; | 120 bool is_popup_first_mouse_release_; |
118 | 121 |
119 // The GtkIMContext object. | 122 // Whether or not this widget was focused before shadowed by another widget. |
120 // In terms of the DOM event specification Appendix A | 123 // Used in OnGrabNotify() handler to track the focused state correctly. |
121 // <http://www.w3.org/TR/DOM-Level-3-Events/keyset.html>, | 124 bool was_focused_before_grab_; |
122 // GTK uses a GtkIMContext object for the following two purposes: | |
123 // 1. Composing Latin characters (A.1.2), and; | |
124 // 2. Composing CJK characters with an IME (A.1.3). | |
125 // Many JavaScript pages assume composed Latin characters are dispatched to | |
126 // their onkeypress() handlers but not dispatched CJK characters composed | |
127 // with an IME. To emulate this behavior, we should monitor the status of | |
128 // this GtkIMContext object and prevent sending Char events when a | |
129 // GtkIMContext object sends a "commit" signal with the CJK characters | |
130 // composed by an IME. | |
131 GtkIMContext* im_context_; | |
132 | 125 |
133 // Whether or not the above GtkIMContext is composing a CJK text with an IME. | 126 // A conveience wrapper object for GtkIMContext; |
134 // The GtkIMContext object sends a "preedit_start" before it starts composing | 127 scoped_ptr<RenderWidgetHostViewGtkIMContext> im_context_; |
135 // a CJK text and a "preedit_end" signal after it finishes composing it. | |
136 // On the other hand, the GtkIMContext object doesn't send them when | |
137 // composing Latin texts. So, we monitor the above signals to check whether | |
138 // or not the GtkIMContext object is composing a CJK text. | |
139 bool im_is_composing_cjk_text_; | |
140 | |
141 // Represents the current modifier-key state. | |
142 // This state is used when GtkIMContext signal handlers create Char events | |
143 // because they don't use the GdkEventKey objects and cannot get the state. | |
144 int im_modifier_state_; | |
145 | 128 |
146 // Helper class that lets us allocate plugin containers and move them. | 129 // Helper class that lets us allocate plugin containers and move them. |
147 GtkPluginContainerManager plugin_container_manager_; | 130 GtkPluginContainerManager plugin_container_manager_; |
148 | 131 |
149 // A map of plugin process id -> windows related to that process. | 132 // A map of plugin process id -> windows related to that process. |
150 // Lets us clean up immediately when a plugin process crashes. | 133 // Lets us clean up immediately when a plugin process crashes. |
151 typedef std::multimap<base::ProcessId, gfx::PluginWindowHandle> PluginPidMap; | 134 typedef std::multimap<base::ProcessId, gfx::PluginWindowHandle> PluginPidMap; |
152 PluginPidMap plugin_pid_map_; | 135 PluginPidMap plugin_pid_map_; |
153 }; | 136 }; |
154 | 137 |
155 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ | 138 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ |
OLD | NEW |