| 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 BackingStore* AllocBackingStore(const gfx::Size& size); |
| 62 BackingStore* AllocBackingStore(const gfx::Size& size); | |
| 63 // --------------------------------------------------------------------------- | |
| 64 | 60 |
| 65 gfx::NativeView native_view() const { return view_.get(); } | 61 gfx::NativeView native_view() const { return view_.get(); } |
| 66 | 62 |
| 67 void Paint(const gfx::Rect&); | 63 void Paint(const gfx::Rect&); |
| 68 | 64 |
| 69 private: | 65 private: |
| 70 friend class RenderWidgetHostViewGtkWidget; | 66 friend class RenderWidgetHostViewGtkWidget; |
| 71 | 67 |
| 72 // Update the display cursor for the render view. | 68 // Update the display cursor for the render view. |
| 73 void ShowCurrentCursor(); | 69 void ShowCurrentCursor(); |
| 74 | 70 |
| 75 // When we've requested the text from the X clipboard, GTK returns it to us | 71 // When we've requested the text from the X clipboard, GTK returns it to us |
| 76 // through this callback. | 72 // through this callback. |
| 77 static void ReceivedSelectionText(GtkClipboard* clipboard, | 73 static void ReceivedSelectionText(GtkClipboard* clipboard, |
| 78 const gchar* text, | 74 const gchar* text, |
| 79 gpointer userdata); | 75 gpointer userdata); |
| 80 | 76 |
| 81 // The model object. | 77 // The model object. |
| 82 RenderWidgetHost *const host_; | 78 RenderWidgetHost* const host_; |
| 79 |
| 83 // The native UI widget. | 80 // The native UI widget. |
| 84 OwnedWidgetGtk view_; | 81 OwnedWidgetGtk view_; |
| 82 |
| 85 // Variables used only for popups -------------------------------------------- | 83 // Variables used only for popups -------------------------------------------- |
| 84 |
| 86 // Our parent widget. | 85 // Our parent widget. |
| 87 RenderWidgetHostView* parent_host_view_; | 86 RenderWidgetHostView* parent_host_view_; |
| 87 |
| 88 // The native view of our parent, equivalent to | 88 // The native view of our parent, equivalent to |
| 89 // parent_host_view_->GetNativeView(). | 89 // parent_host_view_->GetNativeView(). |
| 90 GtkWidget* parent_; | 90 GtkWidget* parent_; |
| 91 |
| 91 // This is true when we are currently painting and thus should handle extra | 92 // This is true when we are currently painting and thus should handle extra |
| 92 // paint requests by expanding the invalid rect rather than actually | 93 // paint requests by expanding the invalid rect rather than actually |
| 93 // painting. | 94 // painting. |
| 94 bool about_to_validate_and_paint_; | 95 bool about_to_validate_and_paint_; |
| 96 |
| 95 // This is the rectangle which we'll paint. | 97 // This is the rectangle which we'll paint. |
| 96 gfx::Rect invalid_rect_; | 98 gfx::Rect invalid_rect_; |
| 97 | 99 |
| 98 // Whether we are currently loading. | 100 // Whether we are currently loading. |
| 99 bool is_loading_; | 101 bool is_loading_; |
| 100 | 102 |
| 101 // The cursor for the page. This is passed up from the renderer. | 103 // The cursor for the page. This is passed up from the renderer. |
| 102 WebCursor current_cursor_; | 104 WebCursor current_cursor_; |
| 103 | 105 |
| 104 // Whether or not this widget is hidden. | 106 // Whether or not this widget is hidden. |
| 105 bool is_hidden_; | 107 bool is_hidden_; |
| 106 | 108 |
| 107 // 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 |
| 108 // stay open. | 110 // stay open. |
| 109 bool is_popup_first_mouse_release_; | 111 bool is_popup_first_mouse_release_; |
| 110 }; | 112 }; |
| 111 | 113 |
| 112 #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 |