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 |
(...skipping 12 matching lines...) Expand all Loading... |
23 // See comments in render_widget_host_view.h about this class and its members. | 23 // See comments in render_widget_host_view.h about this class and its members. |
24 // ----------------------------------------------------------------------------- | 24 // ----------------------------------------------------------------------------- |
25 class RenderWidgetHostViewGtk : public RenderWidgetHostView { | 25 class RenderWidgetHostViewGtk : public RenderWidgetHostView { |
26 public: | 26 public: |
27 RenderWidgetHostViewGtk(RenderWidgetHost* widget); | 27 RenderWidgetHostViewGtk(RenderWidgetHost* widget); |
28 ~RenderWidgetHostViewGtk(); | 28 ~RenderWidgetHostViewGtk(); |
29 | 29 |
30 // Initialize this object for use as a drawing area. | 30 // Initialize this object for use as a drawing area. |
31 void InitAsChild(); | 31 void InitAsChild(); |
32 | 32 |
33 // --------------------------------------------------------------------------- | 33 // RenderWidgetHostView implementation. |
34 // Implementation of RenderWidgetHostView... | 34 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
35 | 35 const gfx::Rect& pos); |
36 void InitAsPopup(RenderWidgetHostView* parent_host_view, | 36 virtual RenderWidgetHost* GetRenderWidgetHost() const { return host_; } |
37 const gfx::Rect& pos); | 37 virtual void DidBecomeSelected(); |
38 RenderWidgetHost* GetRenderWidgetHost() const { return host_; } | 38 virtual void WasHidden(); |
39 void DidBecomeSelected(); | 39 virtual void SetSize(const gfx::Size& size); |
40 void WasHidden(); | 40 virtual gfx::NativeView GetNativeView(); |
41 void SetSize(const gfx::Size& size); | 41 virtual void MovePluginWindows( |
42 gfx::NativeView GetNativeView(); | |
43 void MovePluginWindows( | |
44 const std::vector<WebPluginGeometry>& plugin_window_moves); | 42 const std::vector<WebPluginGeometry>& plugin_window_moves); |
45 void Focus(); | 43 virtual void Focus(); |
46 void Blur(); | 44 virtual void Blur(); |
47 bool HasFocus(); | 45 virtual bool HasFocus(); |
48 void Show(); | 46 virtual void Show(); |
49 void Hide(); | 47 virtual void Hide(); |
50 gfx::Rect GetViewBounds() const; | 48 virtual gfx::Rect GetViewBounds() const; |
51 void UpdateCursor(const WebCursor& cursor); | 49 virtual void UpdateCursor(const WebCursor& cursor); |
52 void SetIsLoading(bool is_loading); | 50 virtual void SetIsLoading(bool is_loading); |
53 void IMEUpdateStatus(int control, const gfx::Rect& caret_rect); | 51 virtual void IMEUpdateStatus(int control, const gfx::Rect& caret_rect); |
54 void DidPaintRect(const gfx::Rect& rect); | 52 virtual void DidPaintRect(const gfx::Rect& rect); |
55 void DidScrollRect( | 53 virtual void DidScrollRect(const gfx::Rect& rect, int dx, int dy); |
56 const gfx::Rect& rect, int dx, int dy); | 54 virtual void RenderViewGone(); |
57 void RenderViewGone(); | 55 virtual void Destroy(); |
58 void Destroy(); | 56 virtual void SetTooltipText(const std::wstring& tooltip_text); |
59 void SetTooltipText(const std::wstring& tooltip_text); | 57 virtual void SelectionChanged(const std::string& text); |
60 void SelectionChanged(const std::string& text); | 58 virtual void PasteFromSelectionClipboard(); |
61 void PasteFromSelectionClipboard(); | 59 virtual void ShowingContextMenu(bool showing); |
62 void ShowingContextMenu(bool showing); | 60 virtual BackingStore* AllocBackingStore(const gfx::Size& size); |
63 BackingStore* AllocBackingStore(const gfx::Size& size); | |
64 // --------------------------------------------------------------------------- | |
65 | 61 |
66 gfx::NativeView native_view() const { return view_.get(); } | 62 gfx::NativeView native_view() const { return view_.get(); } |
67 | 63 |
68 void Paint(const gfx::Rect&); | 64 void Paint(const gfx::Rect&); |
69 | 65 |
70 private: | 66 private: |
71 friend class RenderWidgetHostViewGtkWidget; | 67 friend class RenderWidgetHostViewGtkWidget; |
72 | 68 |
73 // Update the display cursor for the render view. | 69 // Update the display cursor for the render view. |
74 void ShowCurrentCursor(); | 70 void ShowCurrentCursor(); |
75 | 71 |
76 // When we've requested the text from the X clipboard, GTK returns it to us | 72 // When we've requested the text from the X clipboard, GTK returns it to us |
77 // through this callback. | 73 // through this callback. |
78 static void ReceivedSelectionText(GtkClipboard* clipboard, | 74 static void ReceivedSelectionText(GtkClipboard* clipboard, |
79 const gchar* text, | 75 const gchar* text, |
80 gpointer userdata); | 76 gpointer userdata); |
81 | 77 |
82 // The model object. | 78 // The model object. |
83 RenderWidgetHost *const host_; | 79 RenderWidgetHost* const host_; |
| 80 |
84 // The native UI widget. | 81 // The native UI widget. |
85 OwnedWidgetGtk view_; | 82 OwnedWidgetGtk view_; |
86 | 83 |
87 // This is true when we are currently painting and thus should handle extra | 84 // This is true when we are currently painting and thus should handle extra |
88 // paint requests by expanding the invalid rect rather than actually | 85 // paint requests by expanding the invalid rect rather than actually |
89 // painting. | 86 // painting. |
90 bool about_to_validate_and_paint_; | 87 bool about_to_validate_and_paint_; |
| 88 |
91 // This is the rectangle which we'll paint. | 89 // This is the rectangle which we'll paint. |
92 gfx::Rect invalid_rect_; | 90 gfx::Rect invalid_rect_; |
93 | 91 |
94 // Whether or not this widget is hidden. | 92 // Whether or not this widget is hidden. |
95 bool is_hidden_; | 93 bool is_hidden_; |
96 | 94 |
97 // Whether we are currently loading. | 95 // Whether we are currently loading. |
98 bool is_loading_; | 96 bool is_loading_; |
99 // The cursor for the page. This is passed up from the renderer. | 97 // The cursor for the page. This is passed up from the renderer. |
100 WebCursor current_cursor_; | 98 WebCursor current_cursor_; |
101 | 99 |
102 // Whether we are showing a context menu. | 100 // Whether we are showing a context menu. |
103 bool is_showing_context_menu_; | 101 bool is_showing_context_menu_; |
104 | 102 |
105 // Variables used only for popups -------------------------------------------- | 103 // Variables used only for popups -------------------------------------------- |
106 // Our parent widget. | 104 // Our parent widget. |
107 RenderWidgetHostView* parent_host_view_; | 105 RenderWidgetHostView* parent_host_view_; |
108 // The native view of our parent, equivalent to | 106 // The native view of our parent, equivalent to |
109 // parent_host_view_->GetNativeView(). | 107 // parent_host_view_->GetNativeView(). |
110 GtkWidget* parent_; | 108 GtkWidget* parent_; |
111 // We ignore the first mouse release on popups. This allows the popup to | 109 // We ignore the first mouse release on popups. This allows the popup to |
112 // stay open. | 110 // stay open. |
113 bool is_popup_first_mouse_release_; | 111 bool is_popup_first_mouse_release_; |
114 }; | 112 }; |
115 | 113 |
116 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ | 114 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ |
OLD | NEW |