| 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 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <vector> | 11 #include <vector> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/gfx/native_widget_types.h" | 14 #include "base/gfx/native_widget_types.h" |
| 15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
| 16 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 16 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 17 #include "chrome/common/owned_widget_gtk.h" | 17 #include "chrome/common/owned_widget_gtk.h" |
| 18 #include "webkit/glue/plugins/gtk_plugin_container_manager.h" | 18 #include "webkit/glue/plugins/gtk_plugin_container_manager.h" |
| 19 #include "webkit/glue/webcursor.h" | 19 #include "webkit/glue/webcursor.h" |
| 20 | 20 |
| 21 class RenderWidgetHost; | 21 class RenderWidgetHost; |
| 22 // A conveience wrapper class for GtkIMContext; | 22 // A conveience wrapper class for GtkIMContext; |
| 23 class GtkIMContextWrapper; | 23 class GtkIMContextWrapper; |
| 24 // A convenience class for handling editor key bindings defined in gtk keyboard |
| 25 // theme. |
| 26 class GtkKeyBindingsHandler; |
| 27 class NativeWebKeyboardEvent; |
| 24 | 28 |
| 25 typedef struct _GtkClipboard GtkClipboard; | 29 typedef struct _GtkClipboard GtkClipboard; |
| 26 typedef struct _GtkSelectionData GtkSelectionData; | 30 typedef struct _GtkSelectionData GtkSelectionData; |
| 27 | 31 |
| 28 // ----------------------------------------------------------------------------- | 32 // ----------------------------------------------------------------------------- |
| 29 // See comments in render_widget_host_view.h about this class and its members. | 33 // See comments in render_widget_host_view.h about this class and its members. |
| 30 // ----------------------------------------------------------------------------- | 34 // ----------------------------------------------------------------------------- |
| 31 class RenderWidgetHostViewGtk : public RenderWidgetHostView { | 35 class RenderWidgetHostViewGtk : public RenderWidgetHostView { |
| 32 public: | 36 public: |
| 33 explicit RenderWidgetHostViewGtk(RenderWidgetHost* widget); | 37 explicit RenderWidgetHostViewGtk(RenderWidgetHost* widget); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 64 virtual void ShowingContextMenu(bool showing); | 68 virtual void ShowingContextMenu(bool showing); |
| 65 virtual BackingStore* AllocBackingStore(const gfx::Size& size); | 69 virtual BackingStore* AllocBackingStore(const gfx::Size& size); |
| 66 virtual void SetBackground(const SkBitmap& background); | 70 virtual void SetBackground(const SkBitmap& background); |
| 67 virtual void CreatePluginContainer(gfx::PluginWindowHandle id); | 71 virtual void CreatePluginContainer(gfx::PluginWindowHandle id); |
| 68 virtual void DestroyPluginContainer(gfx::PluginWindowHandle id); | 72 virtual void DestroyPluginContainer(gfx::PluginWindowHandle id); |
| 69 | 73 |
| 70 gfx::NativeView native_view() const { return view_.get(); } | 74 gfx::NativeView native_view() const { return view_.get(); } |
| 71 | 75 |
| 72 void Paint(const gfx::Rect&); | 76 void Paint(const gfx::Rect&); |
| 73 | 77 |
| 78 // Called by GtkIMContextWrapper to forward a keyboard event to renderer. |
| 79 // Before calling RenderWidgetHost::ForwardKeyboardEvent(), this method |
| 80 // calls GtkKeyBindingsHandler::Match() against the event and send matched |
| 81 // edit commands to renderer by calling |
| 82 // RenderWidgetHost::ForwardEditCommandsForNextKeyEvent(). |
| 83 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 84 |
| 74 private: | 85 private: |
| 75 friend class RenderWidgetHostViewGtkWidget; | 86 friend class RenderWidgetHostViewGtkWidget; |
| 76 | 87 |
| 77 // Update the display cursor for the render view. | 88 // Update the display cursor for the render view. |
| 78 void ShowCurrentCursor(); | 89 void ShowCurrentCursor(); |
| 79 | 90 |
| 80 // The model object. | 91 // The model object. |
| 81 RenderWidgetHost* const host_; | 92 RenderWidgetHost* const host_; |
| 82 | 93 |
| 83 // The native UI widget. | 94 // The native UI widget. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 109 // parent_host_view_->GetNativeView(). | 120 // parent_host_view_->GetNativeView(). |
| 110 GtkWidget* parent_; | 121 GtkWidget* parent_; |
| 111 // We ignore the first mouse release on popups. This allows the popup to | 122 // We ignore the first mouse release on popups. This allows the popup to |
| 112 // stay open. | 123 // stay open. |
| 113 bool is_popup_first_mouse_release_; | 124 bool is_popup_first_mouse_release_; |
| 114 | 125 |
| 115 // Whether or not this widget was focused before shadowed by another widget. | 126 // Whether or not this widget was focused before shadowed by another widget. |
| 116 // Used in OnGrabNotify() handler to track the focused state correctly. | 127 // Used in OnGrabNotify() handler to track the focused state correctly. |
| 117 bool was_focused_before_grab_; | 128 bool was_focused_before_grab_; |
| 118 | 129 |
| 119 // A conveience wrapper object for GtkIMContext; | 130 // A convenience wrapper object for GtkIMContext; |
| 120 scoped_ptr<GtkIMContextWrapper> im_context_; | 131 scoped_ptr<GtkIMContextWrapper> im_context_; |
| 121 | 132 |
| 133 // A convenience object for handling editor key bindings defined in gtk |
| 134 // keyboard theme. |
| 135 scoped_ptr<GtkKeyBindingsHandler> key_bindings_handler_; |
| 136 |
| 122 // Helper class that lets us allocate plugin containers and move them. | 137 // Helper class that lets us allocate plugin containers and move them. |
| 123 GtkPluginContainerManager plugin_container_manager_; | 138 GtkPluginContainerManager plugin_container_manager_; |
| 124 }; | 139 }; |
| 125 | 140 |
| 126 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ | 141 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ |
| OLD | NEW |