| 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..9701280c0fe07a853803efad87b3f2188e0936ce 100644
|
| --- a/content/browser/devtools/protocol/emulation_handler.cc
|
| +++ b/content/browser/devtools/protocol/emulation_handler.cc
|
| @@ -245,6 +245,33 @@ Response EmulationHandler::ClearDeviceMetricsOverride() {
|
| return Response::OK();
|
| }
|
|
|
| +Response EmulationHandler::GetFrameSize(int* width, int* height) {
|
| + // Get size of frame from RWHV if available.
|
| + RenderWidgetHostImpl* widget_host =
|
| + host_ ? host_->GetRenderWidgetHost() : nullptr;
|
| + if (!widget_host)
|
| + return Response::ServerError("Target does not support GetFrameSize");
|
| +
|
| + gfx::Size size = widget_host->GetView()->GetViewBounds().size();
|
| + *width = size.width();
|
| + *height = size.height();
|
| + return Response::OK();
|
| +}
|
| +
|
| +Response EmulationHandler::SetFrameSize(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 SetFrameSize");
|
| +
|
| + widget_host->GetView()->SetSize(gfx::Size(width, height));
|
| + return Response::OK();
|
| +}
|
| +
|
| WebContentsImpl* EmulationHandler::GetWebContents() {
|
| return host_ ?
|
| static_cast<WebContentsImpl*>(WebContents::FromRenderFrameHost(host_)) :
|
|
|