| 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 "base/shared_memory.h" | 15 #include "base/shared_memory.h" |
| 16 #include "chrome/common/ipc_channel.h" | 16 #include "chrome/common/ipc_channel.h" |
| 17 #include "chrome/renderer/render_process.h" |
| 17 #include "skia/ext/platform_canvas.h" | 18 #include "skia/ext/platform_canvas.h" |
| 18 | 19 |
| 19 #include "webkit/glue/webwidget_delegate.h" | 20 #include "webkit/glue/webwidget_delegate.h" |
| 20 #include "webkit/glue/webcursor.h" | 21 #include "webkit/glue/webcursor.h" |
| 21 | 22 |
| 22 class RenderThreadBase; | 23 class RenderThreadBase; |
| 23 struct WebPluginGeometry; | 24 struct WebPluginGeometry; |
| 24 | 25 |
| 25 // RenderWidget provides a communication bridge between a WebWidget and | 26 // RenderWidget provides a communication bridge between a WebWidget and |
| 26 // a RenderWidgetHost, the latter of which lives in a different process. | 27 // a RenderWidgetHost, the latter of which lives in a different process. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect); | 80 virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect); |
| 80 virtual void GetRootWindowRect(WebWidget* webwidget, gfx::Rect* rect); | 81 virtual void GetRootWindowRect(WebWidget* webwidget, gfx::Rect* rect); |
| 81 virtual void GetRootWindowResizerRect(WebWidget* webwidget, gfx::Rect* rect); | 82 virtual void GetRootWindowResizerRect(WebWidget* webwidget, gfx::Rect* rect); |
| 82 virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move); | 83 virtual void DidMove(WebWidget* webwidget, const WebPluginGeometry& move); |
| 83 virtual void RunModal(WebWidget* webwidget) {} | 84 virtual void RunModal(WebWidget* webwidget) {} |
| 84 virtual bool IsHidden() { return is_hidden_; } | 85 virtual bool IsHidden() { return is_hidden_; } |
| 85 | 86 |
| 86 // Close the underlying WebWidget. | 87 // Close the underlying WebWidget. |
| 87 void Close(); | 88 void Close(); |
| 88 | 89 |
| 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 | |
| 93 protected: | 90 protected: |
| 94 // Friend RefCounted so that the dtor can be non-public. Using this class | 91 // Friend RefCounted so that the dtor can be non-public. Using this class |
| 95 // without ref-counting is an error. | 92 // without ref-counting is an error. |
| 96 friend class base::RefCounted<RenderWidget>; | 93 friend class base::RefCounted<RenderWidget>; |
| 97 | 94 |
| 98 RenderWidget(RenderThreadBase* render_thread, bool activatable); | 95 RenderWidget(RenderThreadBase* render_thread, bool activatable); |
| 99 virtual ~RenderWidget(); | 96 virtual ~RenderWidget(); |
| 100 | 97 |
| 101 // Initializes this view with the given opener. CompleteInit must be called | 98 // Initializes this view with the given opener. CompleteInit must be called |
| 102 // later. | 99 // later. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 | 182 |
| 186 // The window we are embedded within. TODO(darin): kill this. | 183 // The window we are embedded within. TODO(darin): kill this. |
| 187 gfx::NativeViewId host_window_; | 184 gfx::NativeViewId host_window_; |
| 188 | 185 |
| 189 // We store the current cursor object so we can avoid spamming SetCursor | 186 // We store the current cursor object so we can avoid spamming SetCursor |
| 190 // messages. | 187 // messages. |
| 191 WebCursor current_cursor_; | 188 WebCursor current_cursor_; |
| 192 // The size of the RenderWidget. | 189 // The size of the RenderWidget. |
| 193 gfx::Size size_; | 190 gfx::Size size_; |
| 194 | 191 |
| 195 // Shared memory handles that are currently in use to transfer an image to | 192 // Transport DIBs that are currently in use to transfer an image to the |
| 196 // the browser. | 193 // browser. |
| 197 base::SharedMemory* current_paint_buf_; | 194 TransportDIB* current_paint_buf_; |
| 198 base::SharedMemory* current_scroll_buf_; | 195 TransportDIB* current_scroll_buf_; |
| 199 | 196 |
| 200 // The smallest bounding rectangle that needs to be re-painted. This is non- | 197 // The smallest bounding rectangle that needs to be re-painted. This is non- |
| 201 // empty if a paint event is pending. | 198 // empty if a paint event is pending. |
| 202 gfx::Rect paint_rect_; | 199 gfx::Rect paint_rect_; |
| 203 | 200 |
| 204 // The clip rect for the pending scroll event. This is non-empty if a | 201 // The clip rect for the pending scroll event. This is non-empty if a |
| 205 // scroll event is pending. | 202 // scroll event is pending. |
| 206 gfx::Rect scroll_rect_; | 203 gfx::Rect scroll_rect_; |
| 207 | 204 |
| 208 // The area that must be reserved for drawing the resize corner. | 205 // The area that must be reserved for drawing the resize corner. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // Whether the window for this RenderWidget can be activated. | 257 // Whether the window for this RenderWidget can be activated. |
| 261 bool activatable_; | 258 bool activatable_; |
| 262 | 259 |
| 263 // Holds all the needed plugin window moves for a scroll. | 260 // Holds all the needed plugin window moves for a scroll. |
| 264 std::vector<WebPluginGeometry> plugin_window_moves_; | 261 std::vector<WebPluginGeometry> plugin_window_moves_; |
| 265 | 262 |
| 266 DISALLOW_EVIL_CONSTRUCTORS(RenderWidget); | 263 DISALLOW_EVIL_CONSTRUCTORS(RenderWidget); |
| 267 }; | 264 }; |
| 268 | 265 |
| 269 #endif // CHROME_RENDERER_RENDER_WIDGET_H__ | 266 #endif // CHROME_RENDERER_RENDER_WIDGET_H__ |
| OLD | NEW |