Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2081)

Unified Diff: content/renderer/render_widget.h

Issue 23364004: Implementation of device metrics emulation in render view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Moved helper class to cc Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698