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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "third_party/skia/include/core/SkBitmap.h" | 26 #include "third_party/skia/include/core/SkBitmap.h" |
27 #include "webkit/glue/webcursor.h" | 27 #include "webkit/glue/webcursor.h" |
28 | 28 |
29 class RenderThreadBase; | 29 class RenderThreadBase; |
30 struct ViewHostMsg_ShowPopup_Params; | 30 struct ViewHostMsg_ShowPopup_Params; |
31 | 31 |
32 namespace gfx { | 32 namespace gfx { |
33 class Point; | 33 class Point; |
34 } | 34 } |
35 | 35 |
| 36 namespace IPC { |
| 37 class SyncMessage; |
| 38 } |
| 39 |
36 namespace skia { | 40 namespace skia { |
37 class PlatformCanvas; | 41 class PlatformCanvas; |
38 } | 42 } |
39 | 43 |
40 namespace WebKit { | 44 namespace WebKit { |
| 45 class WebWidget; |
41 struct WebPopupMenuInfo; | 46 struct WebPopupMenuInfo; |
42 } | 47 } |
43 | 48 |
44 namespace webkit_glue { | 49 namespace webkit_glue { |
45 struct WebPluginGeometry; | 50 struct WebPluginGeometry; |
46 } | 51 } |
47 | 52 |
48 // RenderWidget provides a communication bridge between a WebWidget and | 53 // RenderWidget provides a communication bridge between a WebWidget and |
49 // a RenderWidgetHost, the latter of which lives in a different process. | 54 // a RenderWidgetHost, the latter of which lives in a different process. |
50 class RenderWidget : public IPC::Channel::Listener, | 55 class RenderWidget : public IPC::Channel::Listener, |
51 public IPC::Message::Sender, | 56 public IPC::Message::Sender, |
52 virtual public WebKit::WebWidgetClient, | 57 virtual public WebKit::WebWidgetClient, |
53 public base::RefCounted<RenderWidget> { | 58 public base::RefCounted<RenderWidget> { |
54 public: | 59 public: |
55 // Creates a new RenderWidget. The opener_id is the routing ID of the | 60 // Creates a new RenderWidget. The opener_id is the routing ID of the |
56 // RenderView that this widget lives inside. The render_thread is any | 61 // RenderView that this widget lives inside. The render_thread is any |
57 // RenderThreadBase implementation, mostly commonly RenderThread::current(). | 62 // RenderThreadBase implementation, mostly commonly RenderThread::current(). |
58 static RenderWidget* Create(int32 opener_id, | 63 static RenderWidget* Create(int32 opener_id, |
59 RenderThreadBase* render_thread, | 64 RenderThreadBase* render_thread, |
60 WebKit::WebPopupType popup_type); | 65 WebKit::WebPopupType popup_type); |
61 | 66 |
| 67 // Creates a WebWidget based on the popup type. |
| 68 static WebKit::WebWidget* CreateWebWidget(RenderWidget* render_widget); |
| 69 |
62 // Called after Create to configure a RenderWidget to be rendered by the host | 70 // Called after Create to configure a RenderWidget to be rendered by the host |
63 // as a popup menu with the given data. | 71 // as a popup menu with the given data. |
64 void ConfigureAsExternalPopupMenu(const WebKit::WebPopupMenuInfo& info); | 72 void ConfigureAsExternalPopupMenu(const WebKit::WebPopupMenuInfo& info); |
65 | 73 |
66 // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if | 74 // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if |
67 // not yet assigned a view ID, in which case, the process MUST NOT send | 75 // not yet assigned a view ID, in which case, the process MUST NOT send |
68 // messages with this ID to the parent. | 76 // messages with this ID to the parent. |
69 int32 routing_id() const { | 77 int32 routing_id() const { |
70 return routing_id_; | 78 return routing_id_; |
71 } | 79 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 friend class base::RefCounted<RenderWidget>; | 129 friend class base::RefCounted<RenderWidget>; |
122 | 130 |
123 RenderWidget(RenderThreadBase* render_thread, | 131 RenderWidget(RenderThreadBase* render_thread, |
124 WebKit::WebPopupType popup_type); | 132 WebKit::WebPopupType popup_type); |
125 virtual ~RenderWidget(); | 133 virtual ~RenderWidget(); |
126 | 134 |
127 // Initializes this view with the given opener. CompleteInit must be called | 135 // Initializes this view with the given opener. CompleteInit must be called |
128 // later. | 136 // later. |
129 void Init(int32 opener_id); | 137 void Init(int32 opener_id); |
130 | 138 |
| 139 // Called by Init and subclasses to perform initialization. |
| 140 void DoInit(int32 opener_id, |
| 141 WebKit::WebWidget* web_widget, |
| 142 IPC::SyncMessage* create_widget_message); |
| 143 |
131 // Finishes creation of a pending view started with Init. | 144 // Finishes creation of a pending view started with Init. |
132 void CompleteInit(gfx::NativeViewId parent); | 145 void CompleteInit(gfx::NativeViewId parent); |
133 | 146 |
134 // Paints the given rectangular region of the WebWidget into canvas (a | 147 // Paints the given rectangular region of the WebWidget into canvas (a |
135 // shared memory segment returned by AllocPaintBuf on Windows). The caller | 148 // shared memory segment returned by AllocPaintBuf on Windows). The caller |
136 // must ensure that the given rect fits within the bounds of the WebWidget. | 149 // must ensure that the given rect fits within the bounds of the WebWidget. |
137 void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin, | 150 void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin, |
138 skia::PlatformCanvas* canvas); | 151 skia::PlatformCanvas* canvas); |
139 | 152 |
140 // Paints a border at the given rect for debugging purposes. | 153 // Paints a border at the given rect for debugging purposes. |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 // Indicates if the next sequence of Char events should be suppressed or not. | 337 // Indicates if the next sequence of Char events should be suppressed or not. |
325 bool suppress_next_char_events_; | 338 bool suppress_next_char_events_; |
326 | 339 |
327 // Set to true if painting to the window is handled by the GPU process. | 340 // Set to true if painting to the window is handled by the GPU process. |
328 bool is_gpu_rendering_active_; | 341 bool is_gpu_rendering_active_; |
329 | 342 |
330 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 343 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
331 }; | 344 }; |
332 | 345 |
333 #endif // CHROME_RENDERER_RENDER_WIDGET_H_ | 346 #endif // CHROME_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |