OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 struct WebRenderingStatsImpl; | 58 struct WebRenderingStatsImpl; |
59 } | 59 } |
60 | 60 |
61 namespace cc { class OutputSurface; } | 61 namespace cc { class OutputSurface; } |
62 | 62 |
63 namespace gfx { | 63 namespace gfx { |
64 class Range; | 64 class Range; |
65 } | 65 } |
66 | 66 |
67 namespace content { | 67 namespace content { |
| 68 class ExternalPopupMenu; |
68 class PepperPluginInstanceImpl; | 69 class PepperPluginInstanceImpl; |
69 class RenderWidgetCompositor; | 70 class RenderWidgetCompositor; |
70 class RenderWidgetTest; | 71 class RenderWidgetTest; |
| 72 struct ContextMenuParams; |
71 struct GpuRenderingStats; | 73 struct GpuRenderingStats; |
72 struct WebPluginGeometry; | 74 struct WebPluginGeometry; |
73 | 75 |
74 // RenderWidget provides a communication bridge between a WebWidget and | 76 // RenderWidget provides a communication bridge between a WebWidget and |
75 // a RenderWidgetHost, the latter of which lives in a different process. | 77 // a RenderWidgetHost, the latter of which lives in a different process. |
76 class CONTENT_EXPORT RenderWidget | 78 class CONTENT_EXPORT RenderWidget |
77 : public IPC::Listener, | 79 : public IPC::Listener, |
78 public IPC::Sender, | 80 public IPC::Sender, |
79 NON_EXPORTED_BASE(virtual public WebKit::WebWidgetClient), | 81 NON_EXPORTED_BASE(virtual public WebKit::WebWidgetClient), |
80 NON_EXPORTED_BASE(public WebGraphicsContext3DSwapBuffersClient), | 82 NON_EXPORTED_BASE(public WebGraphicsContext3DSwapBuffersClient), |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 virtual void InstrumentWillBeginFrame() {} | 218 virtual void InstrumentWillBeginFrame() {} |
217 virtual void InstrumentDidBeginFrame() {} | 219 virtual void InstrumentDidBeginFrame() {} |
218 virtual void InstrumentDidCancelFrame() {} | 220 virtual void InstrumentDidCancelFrame() {} |
219 virtual void InstrumentWillComposite() {} | 221 virtual void InstrumentWillComposite() {} |
220 | 222 |
221 virtual bool AllowPartialSwap() const; | 223 virtual bool AllowPartialSwap() const; |
222 bool UsingSynchronousRendererCompositor() const; | 224 bool UsingSynchronousRendererCompositor() const; |
223 | 225 |
224 bool is_swapped_out() { return is_swapped_out_; } | 226 bool is_swapped_out() { return is_swapped_out_; } |
225 | 227 |
| 228 // ScreenMetricsEmulator class manages screen emulation inside a render |
| 229 // widget. This includes resizing, placing view on the screen at desired |
| 230 // position, changing device scale factor, and scaling down the whole |
| 231 // widget if required to fit into the browser window. |
| 232 class ScreenMetricsEmulator; |
| 233 |
| 234 // Emulates screen and widget metrics. Supplied values override everything |
| 235 // coming from host. |
| 236 void EnableScreenMetricsEmulation( |
| 237 const gfx::Size& device_size, |
| 238 const gfx::Rect& widget_rect, |
| 239 float device_scale_factor, |
| 240 bool fit_to_view); |
| 241 void DisableScreenMetricsEmulation(); |
| 242 void SetPopupOriginAdjustmentsForEmulation(ScreenMetricsEmulator* emulator); |
| 243 |
226 protected: | 244 protected: |
227 // Friend RefCounted so that the dtor can be non-public. Using this class | 245 // Friend RefCounted so that the dtor can be non-public. Using this class |
228 // without ref-counting is an error. | 246 // without ref-counting is an error. |
229 friend class base::RefCounted<RenderWidget>; | 247 friend class base::RefCounted<RenderWidget>; |
230 // For unit tests. | 248 // For unit tests. |
231 friend class RenderWidgetTest; | 249 friend class RenderWidgetTest; |
232 | 250 |
233 enum ResizeAck { | 251 enum ResizeAck { |
234 SEND_RESIZE_ACK, | 252 SEND_RESIZE_ACK, |
235 NO_RESIZE_ACK, | 253 NO_RESIZE_ACK, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 // mainly intended to be used in conjuction with WebView::SetIsTransparent(). | 302 // mainly intended to be used in conjuction with WebView::SetIsTransparent(). |
285 virtual void SetBackground(const SkBitmap& bitmap); | 303 virtual void SetBackground(const SkBitmap& bitmap); |
286 | 304 |
287 // Resizes the render widget. | 305 // Resizes the render widget. |
288 void Resize(const gfx::Size& new_size, | 306 void Resize(const gfx::Size& new_size, |
289 const gfx::Size& physical_backing_size, | 307 const gfx::Size& physical_backing_size, |
290 float overdraw_bottom_height, | 308 float overdraw_bottom_height, |
291 const gfx::Rect& resizer_rect, | 309 const gfx::Rect& resizer_rect, |
292 bool is_fullscreen, | 310 bool is_fullscreen, |
293 ResizeAck resize_ack); | 311 ResizeAck resize_ack); |
| 312 virtual void SetScreenMetricsEmulationParameters( |
| 313 float device_scale_factor, float root_layer_scale); |
| 314 void SetExternalPopupOriginAdjustmentsForEmulation( |
| 315 ExternalPopupMenu* popup, ScreenMetricsEmulator* emulator); |
| 316 virtual void OnShowHostContextMenu(ContextMenuParams* params); |
294 | 317 |
295 // RenderWidget IPC message handlers | 318 // RenderWidget IPC message handlers |
296 void OnHandleInputEvent(const WebKit::WebInputEvent* event, | 319 void OnHandleInputEvent(const WebKit::WebInputEvent* event, |
297 const ui::LatencyInfo& latency_info, | 320 const ui::LatencyInfo& latency_info, |
298 bool keyboard_shortcut); | 321 bool keyboard_shortcut); |
299 void OnCursorVisibilityChange(bool is_visible); | 322 void OnCursorVisibilityChange(bool is_visible); |
300 void OnMouseCaptureLost(); | 323 void OnMouseCaptureLost(); |
301 virtual void OnSetFocus(bool enable); | 324 virtual void OnSetFocus(bool enable); |
302 void OnClose(); | 325 void OnClose(); |
303 void OnCreatingNewAck(); | 326 void OnCreatingNewAck(); |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 | 768 |
746 uint32 next_output_surface_id_; | 769 uint32 next_output_surface_id_; |
747 | 770 |
748 #if defined(OS_ANDROID) | 771 #if defined(OS_ANDROID) |
749 // A counter for number of outstanding messages from the renderer to the | 772 // A counter for number of outstanding messages from the renderer to the |
750 // browser regarding IME-type events that have not been acknowledged by the | 773 // browser regarding IME-type events that have not been acknowledged by the |
751 // browser. If this value is not 0 IME events will be dropped. | 774 // browser. If this value is not 0 IME events will be dropped. |
752 int outstanding_ime_acks_; | 775 int outstanding_ime_acks_; |
753 #endif | 776 #endif |
754 | 777 |
| 778 scoped_ptr<ScreenMetricsEmulator> screen_metrics_emulator_; |
| 779 |
| 780 // Popups may be displaced when screen metrics emulation is enabled. |
| 781 // These values are used to properly adjust popup position. |
| 782 gfx::Point popup_view_origin_for_emulation_; |
| 783 gfx::Point popup_screen_origin_for_emulation_; |
| 784 float popup_origin_scale_for_emulation_; |
| 785 |
755 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; | 786 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; |
756 | 787 |
757 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 788 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
758 }; | 789 }; |
759 | 790 |
760 } // namespace content | 791 } // namespace content |
761 | 792 |
762 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 793 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |