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 ui { | 63 namespace ui { |
64 class Range; | 64 class Range; |
65 } | 65 } |
66 | 66 |
67 namespace content { | 67 namespace content { |
| 68 class ContextMenuParams; |
68 class PepperPluginInstanceImpl; | 69 class PepperPluginInstanceImpl; |
69 class RenderWidgetCompositor; | 70 class RenderWidgetCompositor; |
70 class RenderWidgetTest; | 71 class RenderWidgetTest; |
71 struct GpuRenderingStats; | 72 struct GpuRenderingStats; |
72 struct WebPluginGeometry; | 73 struct WebPluginGeometry; |
73 | 74 |
74 // RenderWidget provides a communication bridge between a WebWidget and | 75 // RenderWidget provides a communication bridge between a WebWidget and |
75 // a RenderWidgetHost, the latter of which lives in a different process. | 76 // a RenderWidgetHost, the latter of which lives in a different process. |
76 class CONTENT_EXPORT RenderWidget | 77 class CONTENT_EXPORT RenderWidget |
77 : public IPC::Listener, | 78 : public IPC::Listener, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 virtual void InstrumentWillBeginFrame() {} | 207 virtual void InstrumentWillBeginFrame() {} |
207 virtual void InstrumentDidBeginFrame() {} | 208 virtual void InstrumentDidBeginFrame() {} |
208 virtual void InstrumentDidCancelFrame() {} | 209 virtual void InstrumentDidCancelFrame() {} |
209 virtual void InstrumentWillComposite() {} | 210 virtual void InstrumentWillComposite() {} |
210 | 211 |
211 virtual bool AllowPartialSwap() const; | 212 virtual bool AllowPartialSwap() const; |
212 bool UsingSynchronousRendererCompositor() const; | 213 bool UsingSynchronousRendererCompositor() const; |
213 | 214 |
214 bool is_swapped_out() { return is_swapped_out_; } | 215 bool is_swapped_out() { return is_swapped_out_; } |
215 | 216 |
| 217 // DeviceEmulator class manages device emulation inside a render widget. This |
| 218 // includes resizing, placing view on the screen at desired position, changing |
| 219 // device scale factor, and scaling down the whole widget if required to fit |
| 220 // into the browser window. |
| 221 class DeviceEmulator; |
| 222 |
| 223 // Emulates device and widget metrics. Supplied values override everything |
| 224 // coming from host. |
| 225 void EmulateDevice(bool enabled, |
| 226 const gfx::Size& device_size, |
| 227 const gfx::Rect& widget_rect, |
| 228 float device_scale_factor, |
| 229 bool fit_to_view); |
| 230 void set_popup_device_emulator(DeviceEmulator* emulator); |
| 231 |
216 protected: | 232 protected: |
217 // Friend RefCounted so that the dtor can be non-public. Using this class | 233 // Friend RefCounted so that the dtor can be non-public. Using this class |
218 // without ref-counting is an error. | 234 // without ref-counting is an error. |
219 friend class base::RefCounted<RenderWidget>; | 235 friend class base::RefCounted<RenderWidget>; |
220 // For unit tests. | 236 // For unit tests. |
221 friend class RenderWidgetTest; | 237 friend class RenderWidgetTest; |
222 | 238 |
223 enum ResizeAck { | 239 enum ResizeAck { |
224 SEND_RESIZE_ACK, | 240 SEND_RESIZE_ACK, |
225 NO_RESIZE_ACK, | 241 NO_RESIZE_ACK, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // mainly intended to be used in conjuction with WebView::SetIsTransparent(). | 290 // mainly intended to be used in conjuction with WebView::SetIsTransparent(). |
275 virtual void SetBackground(const SkBitmap& bitmap); | 291 virtual void SetBackground(const SkBitmap& bitmap); |
276 | 292 |
277 // Resizes the render widget. | 293 // Resizes the render widget. |
278 void Resize(const gfx::Size& new_size, | 294 void Resize(const gfx::Size& new_size, |
279 const gfx::Size& physical_backing_size, | 295 const gfx::Size& physical_backing_size, |
280 float overdraw_bottom_height, | 296 float overdraw_bottom_height, |
281 const gfx::Rect& resizer_rect, | 297 const gfx::Rect& resizer_rect, |
282 bool is_fullscreen, | 298 bool is_fullscreen, |
283 ResizeAck resize_ack); | 299 ResizeAck resize_ack); |
| 300 virtual void SetDeviceEmulationParameters(bool enabled, |
| 301 float device_scale_factor, float root_layer_scale); |
| 302 virtual void OnShowHostContextMenu(ContextMenuParams* params); |
284 | 303 |
285 // RenderWidget IPC message handlers | 304 // RenderWidget IPC message handlers |
286 void OnHandleInputEvent(const WebKit::WebInputEvent* event, | 305 void OnHandleInputEvent(const WebKit::WebInputEvent* event, |
287 const ui::LatencyInfo& latency_info, | 306 const ui::LatencyInfo& latency_info, |
288 bool keyboard_shortcut); | 307 bool keyboard_shortcut); |
289 void OnCursorVisibilityChange(bool is_visible); | 308 void OnCursorVisibilityChange(bool is_visible); |
290 void OnMouseCaptureLost(); | 309 void OnMouseCaptureLost(); |
291 virtual void OnSetFocus(bool enable); | 310 virtual void OnSetFocus(bool enable); |
292 void OnClose(); | 311 void OnClose(); |
293 void OnCreatingNewAck(); | 312 void OnCreatingNewAck(); |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 | 750 |
732 uint32 next_output_surface_id_; | 751 uint32 next_output_surface_id_; |
733 | 752 |
734 #if defined(OS_ANDROID) | 753 #if defined(OS_ANDROID) |
735 // A counter for number of outstanding messages from the renderer to the | 754 // A counter for number of outstanding messages from the renderer to the |
736 // browser regarding IME-type events that have not been acknowledged by the | 755 // browser regarding IME-type events that have not been acknowledged by the |
737 // browser. If this value is not 0 IME events will be dropped. | 756 // browser. If this value is not 0 IME events will be dropped. |
738 int outstanding_ime_acks_; | 757 int outstanding_ime_acks_; |
739 #endif | 758 #endif |
740 | 759 |
| 760 scoped_ptr<DeviceEmulator> device_emulator_; |
| 761 |
| 762 // Popup has a weak ptr to the device emulator of creator. |
| 763 base::WeakPtr<DeviceEmulator> popup_device_emulator_; |
| 764 |
741 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; | 765 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; |
742 | 766 |
743 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 767 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
744 }; | 768 }; |
745 | 769 |
746 } // namespace content | 770 } // namespace content |
747 | 771 |
748 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 772 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |