| 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 CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <gdk/gdk.h> | 9 #include <gdk/gdk.h> |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 16 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 17 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 18 #include "ui/base/animation/animation_delegate.h" | 18 #include "ui/base/animation/animation_delegate.h" |
| 19 #include "ui/base/animation/slide_animation.h" | 19 #include "ui/base/animation/slide_animation.h" |
| 20 #include "ui/base/gtk/gtk_signal.h" | 20 #include "ui/base/gtk/gtk_signal.h" |
| 21 #include "ui/base/gtk/gtk_signal_registrar.h" | 21 #include "ui/base/gtk/gtk_signal_registrar.h" |
| 22 #include "ui/base/gtk/owned_widget_gtk.h" | 22 #include "ui/base/gtk/owned_widget_gtk.h" |
| 23 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
| 24 #include "ui/gfx/point.h" | 24 #include "ui/gfx/point.h" |
| 25 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
| 26 #include "webkit/glue/webcursor.h" | 26 #include "webkit/glue/webcursor.h" |
| 27 #include "webkit/plugins/npapi/gtk_plugin_container_manager.h" | 27 #include "webkit/plugins/npapi/gtk_plugin_container_manager.h" |
| 28 | 28 |
| 29 class GtkIMContextWrapper; |
| 30 struct NativeWebKeyboardEvent; |
| 31 |
| 32 namespace content { |
| 29 class RenderWidgetHost; | 33 class RenderWidgetHost; |
| 30 class RenderWidgetHostImpl; | 34 class RenderWidgetHostImpl; |
| 31 class GtkIMContextWrapper; | 35 } |
| 32 struct NativeWebKeyboardEvent; | |
| 33 | 36 |
| 34 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
| 35 namespace ui { | 38 namespace ui { |
| 36 class TooltipWindowGtk; | 39 class TooltipWindowGtk; |
| 37 } | 40 } |
| 38 #else | 41 #else |
| 39 class GtkKeyBindingsHandler; | 42 class GtkKeyBindingsHandler; |
| 40 #endif // defined(OS_CHROMEOS) | 43 #endif // defined(OS_CHROMEOS) |
| 41 | 44 |
| 42 typedef struct _GtkClipboard GtkClipboard; | 45 typedef struct _GtkClipboard GtkClipboard; |
| 43 typedef struct _GtkSelectionData GtkSelectionData; | 46 typedef struct _GtkSelectionData GtkSelectionData; |
| 44 | 47 |
| 45 // ----------------------------------------------------------------------------- | 48 // ----------------------------------------------------------------------------- |
| 46 // See comments in render_widget_host_view.h about this class and its members. | 49 // See comments in render_widget_host_view.h about this class and its members. |
| 47 // ----------------------------------------------------------------------------- | 50 // ----------------------------------------------------------------------------- |
| 48 class RenderWidgetHostViewGtk : public content::RenderWidgetHostViewBase { | 51 class RenderWidgetHostViewGtk : public content::RenderWidgetHostViewBase { |
| 49 public: | 52 public: |
| 50 virtual ~RenderWidgetHostViewGtk(); | 53 virtual ~RenderWidgetHostViewGtk(); |
| 51 | 54 |
| 52 // RenderWidgetHostView implementation. | 55 // RenderWidgetHostView implementation. |
| 53 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | 56 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |
| 54 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; | 57 virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; |
| 55 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 58 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
| 56 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; | 59 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; |
| 57 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 60 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 58 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; | 61 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; |
| 59 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; | 62 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; |
| 60 virtual bool HasFocus() const OVERRIDE; | 63 virtual bool HasFocus() const OVERRIDE; |
| 61 virtual void Show() OVERRIDE; | 64 virtual void Show() OVERRIDE; |
| 62 virtual void Hide() OVERRIDE; | 65 virtual void Hide() OVERRIDE; |
| 63 virtual bool IsShowing() OVERRIDE; | 66 virtual bool IsShowing() OVERRIDE; |
| 64 virtual gfx::Rect GetViewBounds() const OVERRIDE; | 67 virtual gfx::Rect GetViewBounds() const OVERRIDE; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 85 virtual void SetIsLoading(bool is_loading) OVERRIDE; | 88 virtual void SetIsLoading(bool is_loading) OVERRIDE; |
| 86 virtual void TextInputStateChanged(ui::TextInputType type, | 89 virtual void TextInputStateChanged(ui::TextInputType type, |
| 87 bool can_compose_inline) OVERRIDE; | 90 bool can_compose_inline) OVERRIDE; |
| 88 virtual void ImeCancelComposition() OVERRIDE; | 91 virtual void ImeCancelComposition() OVERRIDE; |
| 89 virtual void DidUpdateBackingStore( | 92 virtual void DidUpdateBackingStore( |
| 90 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, | 93 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
| 91 const std::vector<gfx::Rect>& copy_rects) OVERRIDE; | 94 const std::vector<gfx::Rect>& copy_rects) OVERRIDE; |
| 92 virtual void RenderViewGone(base::TerminationStatus status, | 95 virtual void RenderViewGone(base::TerminationStatus status, |
| 93 int error_code) OVERRIDE; | 96 int error_code) OVERRIDE; |
| 94 virtual void Destroy() OVERRIDE; | 97 virtual void Destroy() OVERRIDE; |
| 95 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {} | 98 virtual void WillDestroyRenderWidget(content::RenderWidgetHost* rwh) {} |
| 96 virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE; | 99 virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE; |
| 97 virtual void SelectionChanged(const string16& text, | 100 virtual void SelectionChanged(const string16& text, |
| 98 size_t offset, | 101 size_t offset, |
| 99 const ui::Range& range) OVERRIDE; | 102 const ui::Range& range) OVERRIDE; |
| 100 virtual void SelectionBoundsChanged(const gfx::Rect& start_rect, | 103 virtual void SelectionBoundsChanged(const gfx::Rect& start_rect, |
| 101 const gfx::Rect& end_rect) OVERRIDE; | 104 const gfx::Rect& end_rect) OVERRIDE; |
| 102 virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; | 105 virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE; |
| 103 virtual void OnAcceleratedCompositingStateChange() OVERRIDE; | 106 virtual void OnAcceleratedCompositingStateChange() OVERRIDE; |
| 104 virtual void AcceleratedSurfaceBuffersSwapped( | 107 virtual void AcceleratedSurfaceBuffersSwapped( |
| 105 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 108 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // edit commands to renderer by calling | 145 // edit commands to renderer by calling |
| 143 // RenderWidgetHost::ForwardEditCommandsForNextKeyEvent(). | 146 // RenderWidgetHost::ForwardEditCommandsForNextKeyEvent(). |
| 144 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event); | 147 void ForwardKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 145 | 148 |
| 146 bool RetrieveSurrounding(std::string* text, size_t* cursor_index); | 149 bool RetrieveSurrounding(std::string* text, size_t* cursor_index); |
| 147 | 150 |
| 148 protected: | 151 protected: |
| 149 friend class content::RenderWidgetHostView; | 152 friend class content::RenderWidgetHostView; |
| 150 | 153 |
| 151 // Should construct only via RenderWidgetHostView::CreateViewForWidget. | 154 // Should construct only via RenderWidgetHostView::CreateViewForWidget. |
| 152 explicit RenderWidgetHostViewGtk(RenderWidgetHost* widget); | 155 explicit RenderWidgetHostViewGtk(content::RenderWidgetHost* widget); |
| 153 | 156 |
| 154 private: | 157 private: |
| 155 friend class RenderWidgetHostViewGtkWidget; | 158 friend class RenderWidgetHostViewGtkWidget; |
| 156 | 159 |
| 157 CHROMEGTK_CALLBACK_1(RenderWidgetHostViewGtk, | 160 CHROMEGTK_CALLBACK_1(RenderWidgetHostViewGtk, |
| 158 gboolean, | 161 gboolean, |
| 159 OnWindowStateEvent, | 162 OnWindowStateEvent, |
| 160 GdkEventWindowState*); | 163 GdkEventWindowState*); |
| 161 | 164 |
| 162 CHROMEGTK_CALLBACK_0(RenderWidgetHostViewGtk, | 165 CHROMEGTK_CALLBACK_0(RenderWidgetHostViewGtk, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 179 void DoPopupOrFullscreenInit(GtkWindow* window, const gfx::Rect& bounds); | 182 void DoPopupOrFullscreenInit(GtkWindow* window, const gfx::Rect& bounds); |
| 180 | 183 |
| 181 // Update the display cursor for the render view. | 184 // Update the display cursor for the render view. |
| 182 void ShowCurrentCursor(); | 185 void ShowCurrentCursor(); |
| 183 | 186 |
| 184 void set_last_mouse_down(GdkEventButton* event); | 187 void set_last_mouse_down(GdkEventButton* event); |
| 185 | 188 |
| 186 gfx::Point GetWidgetCenter(); | 189 gfx::Point GetWidgetCenter(); |
| 187 | 190 |
| 188 // The model object. | 191 // The model object. |
| 189 RenderWidgetHostImpl* host_; | 192 content::RenderWidgetHostImpl* host_; |
| 190 | 193 |
| 191 // The native UI widget. | 194 // The native UI widget. |
| 192 ui::OwnedWidgetGtk view_; | 195 ui::OwnedWidgetGtk view_; |
| 193 | 196 |
| 194 // This is true when we are currently painting and thus should handle extra | 197 // This is true when we are currently painting and thus should handle extra |
| 195 // paint requests by expanding the invalid rect rather than actually | 198 // paint requests by expanding the invalid rect rather than actually |
| 196 // painting. | 199 // painting. |
| 197 bool about_to_validate_and_paint_; | 200 bool about_to_validate_and_paint_; |
| 198 | 201 |
| 199 // This is the rectangle which we'll paint. | 202 // This is the rectangle which we'll paint. |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 293 |
| 291 #if defined(OS_CHROMEOS) | 294 #if defined(OS_CHROMEOS) |
| 292 // Custimized tooltip window. | 295 // Custimized tooltip window. |
| 293 scoped_ptr<ui::TooltipWindowGtk> tooltip_window_; | 296 scoped_ptr<ui::TooltipWindowGtk> tooltip_window_; |
| 294 #endif // defined(OS_CHROMEOS) | 297 #endif // defined(OS_CHROMEOS) |
| 295 | 298 |
| 296 ui::GtkSignalRegistrar signals_; | 299 ui::GtkSignalRegistrar signals_; |
| 297 }; | 300 }; |
| 298 | 301 |
| 299 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ | 302 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ |
| OLD | NEW |