Index: content/browser/devtools/protocol/emulation_handler.cc |
diff --git a/content/browser/devtools/protocol/emulation_handler.cc b/content/browser/devtools/protocol/emulation_handler.cc |
index aa0d798a4336d7408220b2a0aff252774ae86c21..269fc622f5f88f236f8de2bfae5ecd3e37d0f86c 100644 |
--- a/content/browser/devtools/protocol/emulation_handler.cc |
+++ b/content/browser/devtools/protocol/emulation_handler.cc |
@@ -245,6 +245,20 @@ Response EmulationHandler::ClearDeviceMetricsOverride() { |
return Response::OK(); |
} |
+Response EmulationHandler::SetVisibleSize(int width, int height) { |
+ if (width < 0 || height < 0) |
+ return Response::InvalidParams("Width and height must be non-negative"); |
+ |
+ // Set size of frame by resizing RWHV if available. |
+ RenderWidgetHostImpl* widget_host = |
+ host_ ? host_->GetRenderWidgetHost() : nullptr; |
+ if (!widget_host) |
+ return Response::ServerError("Target does not support setVisibleSize"); |
+ |
+ widget_host->GetView()->SetSize(gfx::Size(width, height)); |
+ return Response::OK(); |
+} |
+ |
WebContentsImpl* EmulationHandler::GetWebContents() { |
return host_ ? |
static_cast<WebContentsImpl*>(WebContents::FromRenderFrameHost(host_)) : |