Index: content/renderer/render_widget.h |
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h |
index 0d606f88fde96790f280ed1cbbbc05939000aa3f..dbab73390d98d517094033597afdd32f6702d50c 100644 |
--- a/content/renderer/render_widget.h |
+++ b/content/renderer/render_widget.h |
@@ -65,9 +65,11 @@ class Range; |
} |
namespace content { |
+class ExternalPopupMenu; |
class PepperPluginInstanceImpl; |
class RenderWidgetCompositor; |
class RenderWidgetTest; |
+struct ContextMenuParams; |
struct GpuRenderingStats; |
struct WebPluginGeometry; |
@@ -223,6 +225,22 @@ class CONTENT_EXPORT RenderWidget |
bool is_swapped_out() { return is_swapped_out_; } |
+ // ScreenMetricsEmulator class manages screen 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 ScreenMetricsEmulator; |
+ |
+ // Emulates screen and widget metrics. Supplied values override everything |
+ // coming from host. |
+ void EnableScreenMetricsEmulation( |
+ const gfx::Size& device_size, |
+ const gfx::Rect& widget_rect, |
+ float device_scale_factor, |
+ bool fit_to_view); |
+ void DisableScreenMetricsEmulation(); |
+ void SetPopupOriginAdjustmentsForEmulation(ScreenMetricsEmulator* emulator); |
+ |
protected: |
// Friend RefCounted so that the dtor can be non-public. Using this class |
// without ref-counting is an error. |
@@ -291,6 +309,11 @@ class CONTENT_EXPORT RenderWidget |
const gfx::Rect& resizer_rect, |
bool is_fullscreen, |
ResizeAck resize_ack); |
+ virtual void SetScreenMetricsEmulationParameters( |
+ float device_scale_factor, float root_layer_scale); |
+ void SetExternalPopupOriginAdjustmentsForEmulation( |
+ ExternalPopupMenu* popup, ScreenMetricsEmulator* emulator); |
+ virtual void OnShowHostContextMenu(ContextMenuParams* params); |
// RenderWidget IPC message handlers |
void OnHandleInputEvent(const WebKit::WebInputEvent* event, |
@@ -752,6 +775,14 @@ class CONTENT_EXPORT RenderWidget |
int outstanding_ime_acks_; |
#endif |
+ scoped_ptr<ScreenMetricsEmulator> screen_metrics_emulator_; |
+ |
+ // Popups may be displaced when screen metrics emulation is enabled. |
+ // These values are used to properly adjust popup position. |
+ gfx::Point popup_view_origin_for_emulation_; |
+ gfx::Point popup_screen_origin_for_emulation_; |
+ float popup_origin_scale_for_emulation_; |
+ |
base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(RenderWidget); |