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

Unified Diff: content/renderer/render_view_impl.cc

Issue 23364004: Implementation of device metrics emulation in render view. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Style 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_view_impl.cc
===================================================================
--- content/renderer/render_view_impl.cc (revision 221161)
+++ content/renderer/render_view_impl.cc (working copy)
@@ -2361,6 +2361,8 @@
WebWidget* RenderViewImpl::createPopupMenu(WebKit::WebPopupType popup_type) {
RenderWidget* widget =
RenderWidget::Create(routing_id_, popup_type, screen_info_);
+ if (device_emulation_helper_)
+ device_emulation_helper_->PopupCreated(this, widget);
return widget->webwidget();
}
@@ -2455,6 +2457,23 @@
plugin->initializeFrame(main_render_frame_.get());
}
+void RenderViewImpl::emulateDevice(
+ bool enabled,
+ const WebKit::WebSize& device_size,
+ const WebKit::WebRect& view_rect,
+ float device_scale_factor,
+ bool fit_to_view) {
+ if (enabled && webview())
+ webview()->settings()->setForceCompositingMode(true);
+ EmulateDevice(enabled, gfx::Size(device_size), gfx::Rect(view_rect),
+ device_scale_factor, fit_to_view);
+}
+
+void RenderViewImpl::SetDeviceEmulationScale(float scale) {
+ if (webview() && webview()->devToolsAgent())
+ webview()->devToolsAgent()->setDeviceEmulationScale(scale);
+}
+
void RenderViewImpl::didStartLoading() {
if (is_loading_) {
DVLOG(1) << "didStartLoading called while loading";
@@ -2655,6 +2674,8 @@
params.x = touch_editing_context_menu_location_.x();
params.y = touch_editing_context_menu_location_.y();
}
+ if (device_emulation_helper_)
+ device_emulation_helper_->OnShowContextMenu(this, &params);
// Plugins, e.g. PDF, don't currently update the render view when their
// selected text changes, but the context menu params do contain the updated

Powered by Google App Engine
This is Rietveld 408576698