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

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: Rebase Created 7 years, 2 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
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | content/renderer/render_widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698