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

Unified Diff: content/browser/devtools/protocol/emulation_handler.cc

Issue 2226323002: Resize DevTools target frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove getFrameSize, rename to setVisibleSize. Created 4 years, 4 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/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_)) :

Powered by Google App Engine
This is Rietveld 408576698