Index: content/renderer/render_widget.h |
=================================================================== |
--- content/renderer/render_widget.h (revision 221161) |
+++ content/renderer/render_widget.h (working copy) |
@@ -65,6 +65,7 @@ |
} |
namespace content { |
+class ContextMenuParams; |
class PepperPluginInstanceImpl; |
class RenderWidgetCompositor; |
class RenderWidgetTest; |
@@ -213,6 +214,21 @@ |
bool is_swapped_out() { return is_swapped_out_; } |
+ // DeviceEmulator class manages device emulation inside a render widget. This |
+ // includes resizing, placing view on the screen at desired position, changing |
+ // device scale factor, and scaling down the whole widget if required to fit |
+ // into the browser window. |
+ class DeviceEmulator; |
+ |
+ // Emulates device and widget metrics. Supplied values override everything |
+ // coming from host. |
+ void EmulateDevice(bool enabled, |
+ const gfx::Size& device_size, |
+ const gfx::Rect& widget_rect, |
+ float device_scale_factor, |
+ bool fit_to_view); |
+ void set_popup_device_emulator(DeviceEmulator* emulator); |
+ |
protected: |
// Friend RefCounted so that the dtor can be non-public. Using this class |
// without ref-counting is an error. |
@@ -281,6 +297,9 @@ |
const gfx::Rect& resizer_rect, |
bool is_fullscreen, |
ResizeAck resize_ack); |
+ virtual void SetDeviceEmulationParameters(bool enabled, |
+ float device_scale_factor, float root_layer_scale); |
+ virtual void OnShowHostContextMenu(ContextMenuParams* params); |
// RenderWidget IPC message handlers |
void OnHandleInputEvent(const WebKit::WebInputEvent* event, |
@@ -738,6 +757,11 @@ |
int outstanding_ime_acks_; |
#endif |
+ scoped_ptr<DeviceEmulator> device_emulator_; |
+ |
+ // Popup has a weak ptr to the device emulator of creator. |
+ base::WeakPtr<DeviceEmulator> popup_device_emulator_; |
+ |
base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(RenderWidget); |