OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_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/renderer/render_process.h" | 16 #include "chrome/renderer/render_process.h" |
17 #include "ipc/ipc_channel.h" | 17 #include "ipc/ipc_channel.h" |
18 #include "skia/ext/platform_canvas.h" | 18 #include "skia/ext/platform_canvas.h" |
19 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
20 #include "webkit/api/public/WebCompositionCommand.h" | 20 #include "webkit/api/public/WebCompositionCommand.h" |
21 #include "webkit/api/public/WebRect.h" | 21 #include "webkit/api/public/WebRect.h" |
22 #include "webkit/api/public/WebTextDirection.h" | 22 #include "webkit/api/public/WebTextDirection.h" |
23 #include "webkit/api/public/WebWidgetClient.h" | 23 #include "webkit/api/public/WebWidgetClient.h" |
24 #include "webkit/glue/webcursor.h" | 24 #include "webkit/glue/webcursor.h" |
25 | 25 |
26 class RenderThreadBase; | 26 class RenderThreadBase; |
27 struct ViewHostMsg_ShowPopup_Params; | 27 struct ViewHostMsg_ShowPopup_Params; |
28 struct WebPluginGeometry; | |
29 | 28 |
30 namespace WebKit { | 29 namespace WebKit { |
31 struct WebPopupMenuInfo; | 30 struct WebPopupMenuInfo; |
32 } | 31 } |
33 | 32 |
| 33 namespace webkit_glue { |
| 34 struct WebPluginGeometry; |
| 35 } |
| 36 |
34 // RenderWidget provides a communication bridge between a WebWidget and | 37 // RenderWidget provides a communication bridge between a WebWidget and |
35 // a RenderWidgetHost, the latter of which lives in a different process. | 38 // a RenderWidgetHost, the latter of which lives in a different process. |
36 class RenderWidget : public IPC::Channel::Listener, | 39 class RenderWidget : public IPC::Channel::Listener, |
37 public IPC::Message::Sender, | 40 public IPC::Message::Sender, |
38 virtual public WebKit::WebWidgetClient, | 41 virtual public WebKit::WebWidgetClient, |
39 public base::RefCounted<RenderWidget> { | 42 public base::RefCounted<RenderWidget> { |
40 public: | 43 public: |
41 // Creates a new RenderWidget. The opener_id is the routing ID of the | 44 // Creates a new RenderWidget. The opener_id is the routing ID of the |
42 // RenderView that this widget lives inside. The render_thread is any | 45 // RenderView that this widget lives inside. The render_thread is any |
43 // RenderThreadBase implementation, mostly commonly RenderThread::current(). | 46 // RenderThreadBase implementation, mostly commonly RenderThread::current(). |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 virtual void show(WebKit::WebNavigationPolicy); | 80 virtual void show(WebKit::WebNavigationPolicy); |
78 virtual void runModal() {} | 81 virtual void runModal() {} |
79 virtual WebKit::WebRect windowRect(); | 82 virtual WebKit::WebRect windowRect(); |
80 virtual void setWindowRect(const WebKit::WebRect&); | 83 virtual void setWindowRect(const WebKit::WebRect&); |
81 virtual WebKit::WebRect windowResizerRect(); | 84 virtual WebKit::WebRect windowResizerRect(); |
82 virtual WebKit::WebRect rootWindowRect(); | 85 virtual WebKit::WebRect rootWindowRect(); |
83 virtual WebKit::WebScreenInfo screenInfo(); | 86 virtual WebKit::WebScreenInfo screenInfo(); |
84 | 87 |
85 // Called when a plugin is moved. These events are queued up and sent with | 88 // Called when a plugin is moved. These events are queued up and sent with |
86 // the next paint or scroll message to the host. | 89 // the next paint or scroll message to the host. |
87 void SchedulePluginMove(const WebPluginGeometry& move); | 90 void SchedulePluginMove(const webkit_glue::WebPluginGeometry& move); |
88 | 91 |
89 // Called when a plugin window has been destroyed, to make sure the currently | 92 // Called when a plugin window has been destroyed, to make sure the currently |
90 // pending moves don't try to reference it. | 93 // pending moves don't try to reference it. |
91 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window); | 94 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window); |
92 | 95 |
93 // Invalidates entire widget rect to generate a full repaint. | 96 // Invalidates entire widget rect to generate a full repaint. |
94 void GenerateFullRepaint(); | 97 void GenerateFullRepaint(); |
95 | 98 |
96 // Close the underlying WebWidget. | 99 // Close the underlying WebWidget. |
97 void Close(); | 100 void Close(); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 int ime_control_x_; | 293 int ime_control_x_; |
291 int ime_control_y_; | 294 int ime_control_y_; |
292 bool ime_control_new_state_; | 295 bool ime_control_new_state_; |
293 bool ime_control_updated_; | 296 bool ime_control_updated_; |
294 bool ime_control_busy_; | 297 bool ime_control_busy_; |
295 | 298 |
296 // Whether the window for this RenderWidget can be activated. | 299 // Whether the window for this RenderWidget can be activated. |
297 bool activatable_; | 300 bool activatable_; |
298 | 301 |
299 // Holds all the needed plugin window moves for a scroll. | 302 // Holds all the needed plugin window moves for a scroll. |
300 typedef std::vector<WebPluginGeometry> WebPluginGeometryVector; | 303 typedef std::vector<webkit_glue::WebPluginGeometry> WebPluginGeometryVector; |
301 WebPluginGeometryVector plugin_window_moves_; | 304 WebPluginGeometryVector plugin_window_moves_; |
302 | 305 |
303 // A custom background for the widget. | 306 // A custom background for the widget. |
304 SkBitmap background_; | 307 SkBitmap background_; |
305 | 308 |
306 // While we are waiting for the browser to update window sizes, | 309 // While we are waiting for the browser to update window sizes, |
307 // we track the pending size temporarily. | 310 // we track the pending size temporarily. |
308 int pending_window_rect_count_; | 311 int pending_window_rect_count_; |
309 WebKit::WebRect pending_window_rect_; | 312 WebKit::WebRect pending_window_rect_; |
310 | 313 |
311 scoped_ptr<ViewHostMsg_ShowPopup_Params> popup_params_; | 314 scoped_ptr<ViewHostMsg_ShowPopup_Params> popup_params_; |
312 | 315 |
313 scoped_ptr<IPC::Message> pending_input_event_ack_; | 316 scoped_ptr<IPC::Message> pending_input_event_ack_; |
314 | 317 |
315 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 318 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
316 }; | 319 }; |
317 | 320 |
318 #endif // CHROME_RENDERER_RENDER_WIDGET_H_ | 321 #endif // CHROME_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |