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/point.h" | 11 #include "base/gfx/point.h" |
11 #include "base/gfx/rect.h" | 12 #include "base/gfx/rect.h" |
12 #include "base/gfx/size.h" | 13 #include "base/gfx/size.h" |
13 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
14 #include "chrome/common/ipc_channel.h" | 15 #include "chrome/common/ipc_channel.h" |
15 #include "chrome/common/render_messages.h" | 16 #include "chrome/common/render_messages.h" |
16 | 17 |
17 #include "webkit/glue/webwidget_delegate.h" | 18 #include "webkit/glue/webwidget_delegate.h" |
18 #include "webkit/glue/webcursor.h" | 19 #include "webkit/glue/webcursor.h" |
19 #include "webkit/glue/webplugin.h" | 20 #include "webkit/glue/webplugin.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // IPC::Channel::Listener | 58 // IPC::Channel::Listener |
58 virtual void OnMessageReceived(const IPC::Message& msg); | 59 virtual void OnMessageReceived(const IPC::Message& msg); |
59 | 60 |
60 // IPC::Message::Sender | 61 // IPC::Message::Sender |
61 virtual bool Send(IPC::Message* msg); | 62 virtual bool Send(IPC::Message* msg); |
62 | 63 |
63 // True if the underlying IPC is currently sending data. | 64 // True if the underlying IPC is currently sending data. |
64 bool InSend() const; | 65 bool InSend() const; |
65 | 66 |
66 // WebWidgetDelegate | 67 // WebWidgetDelegate |
67 virtual gfx::NativeView GetContainingView(WebWidget* webwidget); | 68 virtual gfx::NativeViewId GetContainingView(WebWidget* webwidget); |
68 virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect); | 69 virtual void DidInvalidateRect(WebWidget* webwidget, const gfx::Rect& rect); |
69 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, | 70 virtual void DidScrollRect(WebWidget* webwidget, int dx, int dy, |
70 const gfx::Rect& clip_rect); | 71 const gfx::Rect& clip_rect); |
71 virtual void SetCursor(WebWidget* webwidget, const WebCursor& cursor); | 72 virtual void SetCursor(WebWidget* webwidget, const WebCursor& cursor); |
72 virtual void Show(WebWidget* webwidget, WindowOpenDisposition disposition); | 73 virtual void Show(WebWidget* webwidget, WindowOpenDisposition disposition); |
73 virtual void CloseWidgetSoon(WebWidget* webwidget); | 74 virtual void CloseWidgetSoon(WebWidget* webwidget); |
74 virtual void Focus(WebWidget* webwidget); | 75 virtual void Focus(WebWidget* webwidget); |
75 virtual void Blur(WebWidget* webwidget); | 76 virtual void Blur(WebWidget* webwidget); |
76 virtual void GetWindowRect(WebWidget* webwidget, gfx::Rect* rect); | 77 virtual void GetWindowRect(WebWidget* webwidget, gfx::Rect* rect); |
77 virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect); | 78 virtual void SetWindowRect(WebWidget* webwidget, const gfx::Rect& rect); |
(...skipping 12 matching lines...) Expand all Loading... |
90 friend class base::RefCounted<RenderWidget>; | 91 friend class base::RefCounted<RenderWidget>; |
91 | 92 |
92 RenderWidget(RenderThreadBase* render_thread, bool activatable); | 93 RenderWidget(RenderThreadBase* render_thread, bool activatable); |
93 virtual ~RenderWidget(); | 94 virtual ~RenderWidget(); |
94 | 95 |
95 // Initializes this view with the given opener. CompleteInit must be called | 96 // Initializes this view with the given opener. CompleteInit must be called |
96 // later. | 97 // later. |
97 void Init(int32 opener_id); | 98 void Init(int32 opener_id); |
98 | 99 |
99 // Finishes creation of a pending view started with Init. | 100 // Finishes creation of a pending view started with Init. |
100 void CompleteInit(HWND parent); | 101 void CompleteInit(gfx::NativeViewId parent); |
101 | 102 |
102 // Paints the given rectangular region of the WebWidget into paint_buf (a | 103 // Paints the given rectangular region of the WebWidget into paint_buf (a |
103 // shared memory segment returned by AllocPaintBuf). The caller must ensure | 104 // shared memory segment returned by AllocPaintBuf). The caller must ensure |
104 // that the given rect fits within the bounds of the WebWidget. | 105 // that the given rect fits within the bounds of the WebWidget. |
105 void PaintRect(const gfx::Rect& rect, base::SharedMemory* paint_buf); | 106 void PaintRect(const gfx::Rect& rect, base::SharedMemory* paint_buf); |
106 | 107 |
107 // Get the size of the paint buffer for the given rectangle, rounding up to | 108 // Get the size of the paint buffer for the given rectangle, rounding up to |
108 // the allocation granularity of the system. | 109 // the allocation granularity of the system. |
109 size_t GetPaintBufSize(const gfx::Rect& rect); | 110 size_t GetPaintBufSize(const gfx::Rect& rect); |
110 | 111 |
111 void DoDeferredPaint(); | 112 void DoDeferredPaint(); |
112 void DoDeferredScroll(); | 113 void DoDeferredScroll(); |
113 | 114 |
114 // This method is called immediately after PaintRect but before the | 115 // This method is called immediately after PaintRect but before the |
115 // corresponding paint or scroll message is send to the widget host. | 116 // corresponding paint or scroll message is send to the widget host. |
116 virtual void DidPaint() {} | 117 virtual void DidPaint() {} |
117 | 118 |
118 // RenderWidget IPC message handlers | 119 // RenderWidget IPC message handlers |
119 void OnClose(); | 120 void OnClose(); |
120 void OnCreatingNewAck(HWND parent); | 121 void OnCreatingNewAck(gfx::NativeViewId parent); |
121 void OnResize(const gfx::Size& new_size); | 122 void OnResize(const gfx::Size& new_size); |
122 void OnWasHidden(); | 123 void OnWasHidden(); |
123 void OnWasRestored(bool needs_repainting); | 124 void OnWasRestored(bool needs_repainting); |
124 void OnPaintRectAck(); | 125 void OnPaintRectAck(); |
125 void OnScrollRectAck(); | 126 void OnScrollRectAck(); |
126 void OnHandleInputEvent(const IPC::Message& message); | 127 void OnHandleInputEvent(const IPC::Message& message); |
127 void OnMouseCaptureLost(); | 128 void OnMouseCaptureLost(); |
128 void OnSetFocus(bool enable); | 129 void OnSetFocus(bool enable); |
129 void OnImeSetInputMode(bool is_active); | 130 void OnImeSetInputMode(bool is_active); |
130 void OnImeSetComposition(int string_type, int cursor_position, | 131 void OnImeSetComposition(int string_type, int cursor_position, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // view is. | 189 // view is. |
189 int32 opener_id_; | 190 int32 opener_id_; |
190 | 191 |
191 // The thread that does our IPC. | 192 // The thread that does our IPC. |
192 RenderThreadBase* render_thread_; | 193 RenderThreadBase* render_thread_; |
193 | 194 |
194 // The position where this view should be initially shown. | 195 // The position where this view should be initially shown. |
195 gfx::Rect initial_pos_; | 196 gfx::Rect initial_pos_; |
196 | 197 |
197 // The window we are embedded within. TODO(darin): kill this. | 198 // The window we are embedded within. TODO(darin): kill this. |
198 HWND host_window_; | 199 gfx::NativeViewId host_window_; |
199 | 200 |
200 // We store the current cursor object so we can avoid spamming SetCursor | 201 // We store the current cursor object so we can avoid spamming SetCursor |
201 // messages. | 202 // messages. |
202 WebCursor current_cursor_; | 203 WebCursor current_cursor_; |
203 // The size of the RenderWidget. | 204 // The size of the RenderWidget. |
204 gfx::Size size_; | 205 gfx::Size size_; |
205 | 206 |
206 // Shared memory handles that are currently in use to transfer an image to | 207 // Shared memory handles that are currently in use to transfer an image to |
207 // the browser. | 208 // the browser. |
208 base::SharedMemory* current_paint_buf_; | 209 base::SharedMemory* current_paint_buf_; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 // Whether the window for this RenderWidget can be activated. | 269 // Whether the window for this RenderWidget can be activated. |
269 bool activatable_; | 270 bool activatable_; |
270 | 271 |
271 // Holds all the needed plugin window moves for a scroll. | 272 // Holds all the needed plugin window moves for a scroll. |
272 std::vector<WebPluginGeometry> plugin_window_moves_; | 273 std::vector<WebPluginGeometry> plugin_window_moves_; |
273 | 274 |
274 DISALLOW_EVIL_CONSTRUCTORS(RenderWidget); | 275 DISALLOW_EVIL_CONSTRUCTORS(RenderWidget); |
275 }; | 276 }; |
276 | 277 |
277 #endif // CHROME_RENDERER_RENDER_WIDGET_H__ | 278 #endif // CHROME_RENDERER_RENDER_WIDGET_H__ |
OLD | NEW |