OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_RENDERER_RENDER_WIDGET_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_ |
6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ | 6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Creates a new RenderWidget. The opener_id is the routing ID of the | 67 // Creates a new RenderWidget. The opener_id is the routing ID of the |
68 // RenderView that this widget lives inside. The render_thread is any | 68 // RenderView that this widget lives inside. The render_thread is any |
69 // RenderThreadBase implementation, mostly commonly RenderThread::current(). | 69 // RenderThreadBase implementation, mostly commonly RenderThread::current(). |
70 static RenderWidget* Create(int32 opener_id, | 70 static RenderWidget* Create(int32 opener_id, |
71 RenderThreadBase* render_thread, | 71 RenderThreadBase* render_thread, |
72 WebKit::WebPopupType popup_type); | 72 WebKit::WebPopupType popup_type); |
73 | 73 |
74 // Creates a WebWidget based on the popup type. | 74 // Creates a WebWidget based on the popup type. |
75 static WebKit::WebWidget* CreateWebWidget(RenderWidget* render_widget); | 75 static WebKit::WebWidget* CreateWebWidget(RenderWidget* render_widget); |
76 | 76 |
| 77 // The compositing surface assigned by the RenderWidgetHost |
| 78 // (or RenderViewHost). Will be gfx::kNullPluginWindow if not assigned yet, |
| 79 // in which case we should not create any GPU command buffers with it. |
| 80 gfx::PluginWindowHandle compositing_surface() const { |
| 81 return compositing_surface_; |
| 82 } |
| 83 |
77 // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if | 84 // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if |
78 // not yet assigned a view ID, in which case, the process MUST NOT send | 85 // not yet assigned a view ID, in which case, the process MUST NOT send |
79 // messages with this ID to the parent. | 86 // messages with this ID to the parent. |
80 int32 routing_id() const { | 87 int32 routing_id() const { |
81 return routing_id_; | 88 return routing_id_; |
82 } | 89 } |
83 | 90 |
84 // May return NULL when the window is closing. | 91 // May return NULL when the window is closing. |
85 WebKit::WebWidget* webwidget() const { return webwidget_; } | 92 WebKit::WebWidget* webwidget() const { return webwidget_; } |
86 gfx::NativeViewId host_window() const { return host_window_; } | 93 gfx::NativeViewId host_window() const { return host_window_; } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Initializes this view with the given opener. CompleteInit must be called | 144 // Initializes this view with the given opener. CompleteInit must be called |
138 // later. | 145 // later. |
139 void Init(int32 opener_id); | 146 void Init(int32 opener_id); |
140 | 147 |
141 // Called by Init and subclasses to perform initialization. | 148 // Called by Init and subclasses to perform initialization. |
142 void DoInit(int32 opener_id, | 149 void DoInit(int32 opener_id, |
143 WebKit::WebWidget* web_widget, | 150 WebKit::WebWidget* web_widget, |
144 IPC::SyncMessage* create_widget_message); | 151 IPC::SyncMessage* create_widget_message); |
145 | 152 |
146 // Finishes creation of a pending view started with Init. | 153 // Finishes creation of a pending view started with Init. |
147 void CompleteInit(gfx::NativeViewId parent); | 154 void CompleteInit(gfx::NativeViewId parent, |
| 155 gfx::PluginWindowHandle compositing_surface); |
148 | 156 |
149 // Paints the given rectangular region of the WebWidget into canvas (a | 157 // Paints the given rectangular region of the WebWidget into canvas (a |
150 // shared memory segment returned by AllocPaintBuf on Windows). The caller | 158 // shared memory segment returned by AllocPaintBuf on Windows). The caller |
151 // must ensure that the given rect fits within the bounds of the WebWidget. | 159 // must ensure that the given rect fits within the bounds of the WebWidget. |
152 void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin, | 160 void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin, |
153 skia::PlatformCanvas* canvas); | 161 skia::PlatformCanvas* canvas); |
154 | 162 |
155 // Paints a border at the given rect for debugging purposes. | 163 // Paints a border at the given rect for debugging purposes. |
156 void PaintDebugBorder(const gfx::Rect& rect, skia::PlatformCanvas* canvas); | 164 void PaintDebugBorder(const gfx::Rect& rect, skia::PlatformCanvas* canvas); |
157 | 165 |
158 void AnimationCallback(); | 166 void AnimationCallback(); |
159 void AnimateIfNeeded(); | 167 void AnimateIfNeeded(); |
160 void CallDoDeferredUpdate(); | 168 void CallDoDeferredUpdate(); |
161 void DoDeferredUpdate(); | 169 void DoDeferredUpdate(); |
162 void DoDeferredClose(); | 170 void DoDeferredClose(); |
163 void DoDeferredSetWindowRect(const WebKit::WebRect& pos); | 171 void DoDeferredSetWindowRect(const WebKit::WebRect& pos); |
164 | 172 |
165 // Set the background of the render widget to a bitmap. The bitmap will be | 173 // Set the background of the render widget to a bitmap. The bitmap will be |
166 // tiled in both directions if it isn't big enough to fill the area. This is | 174 // tiled in both directions if it isn't big enough to fill the area. This is |
167 // mainly intended to be used in conjuction with WebView::SetIsTransparent(). | 175 // mainly intended to be used in conjuction with WebView::SetIsTransparent(). |
168 virtual void SetBackground(const SkBitmap& bitmap); | 176 virtual void SetBackground(const SkBitmap& bitmap); |
169 | 177 |
170 // RenderWidget IPC message handlers | 178 // RenderWidget IPC message handlers |
171 void OnClose(); | 179 void OnClose(); |
172 void OnCreatingNewAck(gfx::NativeViewId parent); | 180 void OnCreatingNewAck(gfx::NativeViewId parent, |
| 181 gfx::PluginWindowHandle compositing_surface); |
173 virtual void OnResize(const gfx::Size& new_size, | 182 virtual void OnResize(const gfx::Size& new_size, |
174 const gfx::Rect& resizer_rect); | 183 const gfx::Rect& resizer_rect); |
175 virtual void OnWasHidden(); | 184 virtual void OnWasHidden(); |
176 virtual void OnWasRestored(bool needs_repainting); | 185 virtual void OnWasRestored(bool needs_repainting); |
177 void OnUpdateRectAck(); | 186 void OnUpdateRectAck(); |
178 void OnCreateVideoAck(int32 video_id); | 187 void OnCreateVideoAck(int32 video_id); |
179 void OnUpdateVideoAck(int32 video_id); | 188 void OnUpdateVideoAck(int32 video_id); |
180 void OnRequestMoveAck(); | 189 void OnRequestMoveAck(); |
181 void OnHandleInputEvent(const IPC::Message& message); | 190 void OnHandleInputEvent(const IPC::Message& message); |
182 void OnMouseCaptureLost(); | 191 void OnMouseCaptureLost(); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 369 |
361 scoped_ptr<IPC::Message> pending_input_event_ack_; | 370 scoped_ptr<IPC::Message> pending_input_event_ack_; |
362 | 371 |
363 // Indicates if the next sequence of Char events should be suppressed or not. | 372 // Indicates if the next sequence of Char events should be suppressed or not. |
364 bool suppress_next_char_events_; | 373 bool suppress_next_char_events_; |
365 | 374 |
366 // Set to true if painting to the window is handled by the accelerated | 375 // Set to true if painting to the window is handled by the accelerated |
367 // compositor. | 376 // compositor. |
368 bool is_accelerated_compositing_active_; | 377 bool is_accelerated_compositing_active_; |
369 | 378 |
| 379 // Handle to a surface that is drawn to when accelerated compositing is |
| 380 // active. |
| 381 gfx::PluginWindowHandle compositing_surface_; |
| 382 |
370 base::Time animation_floor_time_; | 383 base::Time animation_floor_time_; |
371 bool animation_update_pending_; | 384 bool animation_update_pending_; |
372 bool animation_task_posted_; | 385 bool animation_task_posted_; |
373 | 386 |
374 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 387 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
375 }; | 388 }; |
376 | 389 |
377 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 390 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |