OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_RENDERER_RENDER_WIDGET_H__ | 5 #ifndef CHROME_RENDERER_RENDER_WIDGET_H__ |
6 #define CHROME_RENDERER_RENDER_WIDGET_H__ | 6 #define CHROME_RENDERER_RENDER_WIDGET_H__ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/gfx/native_widget_types.h" | 10 #include "base/gfx/native_widget_types.h" |
11 #include "base/gfx/point.h" | 11 #include "base/gfx/point.h" |
12 #include "base/gfx/rect.h" | 12 #include "base/gfx/rect.h" |
13 #include "base/gfx/size.h" | 13 #include "base/gfx/size.h" |
14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
15 #include "chrome/common/ipc_channel.h" | 15 #include "chrome/common/ipc_channel.h" |
16 #include "chrome/common/render_messages.h" | 16 #include "chrome/common/render_messages.h" |
| 17 #include "skia/ext/platform_canvas.h" |
17 | 18 |
18 #include "webkit/glue/webwidget_delegate.h" | 19 #include "webkit/glue/webwidget_delegate.h" |
19 #include "webkit/glue/webcursor.h" | 20 #include "webkit/glue/webcursor.h" |
20 #include "webkit/glue/webplugin.h" | 21 #include "webkit/glue/webplugin.h" |
21 | 22 |
22 class RenderThreadBase; | 23 class RenderThreadBase; |
23 | 24 |
24 // RenderWidget provides a communication bridge between a WebWidget and | 25 // RenderWidget provides a communication bridge between a WebWidget and |
25 // a RenderWidgetHost, the latter of which lives in a different process. | 26 // a RenderWidgetHost, the latter of which lives in a different process. |
26 class RenderWidget : public IPC::Channel::Listener, | 27 class RenderWidget : public IPC::Channel::Listener, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect); | 79 virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect); |
79 virtual void GetRootWindowRect(WebWidget* webwidget, gfx::Rect* rect); | 80 virtual void GetRootWindowRect(WebWidget* webwidget, gfx::Rect* rect); |
80 virtual void GetRootWindowResizerRect(WebWidget* webwidget, gfx::Rect* rect); | 81 virtual void GetRootWindowResizerRect(WebWidget* webwidget, gfx::Rect* rect); |
81 virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move); | 82 virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move); |
82 virtual void RunModal(WebWidget* webwidget) {} | 83 virtual void RunModal(WebWidget* webwidget) {} |
83 virtual bool IsHidden() { return is_hidden_; } | 84 virtual bool IsHidden() { return is_hidden_; } |
84 | 85 |
85 // Close the underlying WebWidget. | 86 // Close the underlying WebWidget. |
86 void Close(); | 87 void Close(); |
87 | 88 |
| 89 // Get the size of the paint buffer for the given rectangle, rounding up to |
| 90 // the allocation granularity of the system. |
| 91 static size_t GetPaintBufSize(const gfx::Rect& rect); |
| 92 |
88 protected: | 93 protected: |
89 // Friend RefCounted so that the dtor can be non-public. Using this class | 94 // Friend RefCounted so that the dtor can be non-public. Using this class |
90 // without ref-counting is an error. | 95 // without ref-counting is an error. |
91 friend class base::RefCounted<RenderWidget>; | 96 friend class base::RefCounted<RenderWidget>; |
92 | 97 |
93 RenderWidget(RenderThreadBase* render_thread, bool activatable); | 98 RenderWidget(RenderThreadBase* render_thread, bool activatable); |
94 virtual ~RenderWidget(); | 99 virtual ~RenderWidget(); |
95 | 100 |
96 // Initializes this view with the given opener. CompleteInit must be called | 101 // Initializes this view with the given opener. CompleteInit must be called |
97 // later. | 102 // later. |
98 void Init(int32 opener_id); | 103 void Init(int32 opener_id); |
99 | 104 |
100 // Finishes creation of a pending view started with Init. | 105 // Finishes creation of a pending view started with Init. |
101 void CompleteInit(gfx::NativeViewId parent); | 106 void CompleteInit(gfx::NativeViewId parent); |
102 | 107 |
103 // Paints the given rectangular region of the WebWidget into paint_buf (a | 108 // Paints the given rectangular region of the WebWidget into canvas (a |
104 // shared memory segment returned by AllocPaintBuf). The caller must ensure | 109 // shared memory segment returned by AllocPaintBuf on Windows). The caller |
105 // that the given rect fits within the bounds of the WebWidget. | 110 // must ensure that the given rect fits within the bounds of the WebWidget. |
106 void PaintRect(const gfx::Rect& rect, base::SharedMemory* paint_buf); | 111 void PaintRect(const gfx::Rect& rect, skia::PlatformCanvas* canvas); |
107 | |
108 // Get the size of the paint buffer for the given rectangle, rounding up to | |
109 // the allocation granularity of the system. | |
110 size_t GetPaintBufSize(const gfx::Rect& rect); | |
111 | 112 |
112 void DoDeferredPaint(); | 113 void DoDeferredPaint(); |
113 void DoDeferredScroll(); | 114 void DoDeferredScroll(); |
114 | 115 |
115 // This method is called immediately after PaintRect but before the | 116 // This method is called immediately after PaintRect but before the |
116 // corresponding paint or scroll message is send to the widget host. | 117 // corresponding paint or scroll message is send to the widget host. |
117 virtual void DidPaint() {} | 118 virtual void DidPaint() {} |
118 | 119 |
119 // RenderWidget IPC message handlers | 120 // RenderWidget IPC message handlers |
120 void OnClose(); | 121 void OnClose(); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 // Whether the window for this RenderWidget can be activated. | 270 // Whether the window for this RenderWidget can be activated. |
270 bool activatable_; | 271 bool activatable_; |
271 | 272 |
272 // Holds all the needed plugin window moves for a scroll. | 273 // Holds all the needed plugin window moves for a scroll. |
273 std::vector<WebPluginGeometry> plugin_window_moves_; | 274 std::vector<WebPluginGeometry> plugin_window_moves_; |
274 | 275 |
275 DISALLOW_EVIL_CONSTRUCTORS(RenderWidget); | 276 DISALLOW_EVIL_CONSTRUCTORS(RenderWidget); |
276 }; | 277 }; |
277 | 278 |
278 #endif // CHROME_RENDERER_RENDER_WIDGET_H__ | 279 #endif // CHROME_RENDERER_RENDER_WIDGET_H__ |
OLD | NEW |