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

Unified Diff: components/devtools_discovery/devtools_discovery_manager.cc

Issue 2226323002: Resize DevTools target frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename, add tests, fix comments/style, add support in shell. 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: components/devtools_discovery/devtools_discovery_manager.cc
diff --git a/components/devtools_discovery/devtools_discovery_manager.cc b/components/devtools_discovery/devtools_discovery_manager.cc
index 3c472fa7bfbc1c9894db48d653a24086ca079d89..3b467ac900d602fc7e1dec4c68aa0eeee5b22c8b 100644
--- a/components/devtools_discovery/devtools_discovery_manager.cc
+++ b/components/devtools_discovery/devtools_discovery_manager.cc
@@ -7,8 +7,12 @@
#include "base/stl_util.h"
#include "components/devtools_discovery/basic_target_descriptor.h"
#include "content/public/browser/devtools_agent_host.h"
+#include "content/public/browser/render_widget_host_view.h"
+#include "content/public/browser/web_contents.h"
using content::DevToolsAgentHost;
+using content::WebContents;
+using content::RenderWidgetHostView;
namespace devtools_discovery {
@@ -63,9 +67,9 @@ DevToolsDiscoveryManager::GetDescriptorsFromProviders() {
}
std::unique_ptr<base::DictionaryValue>
-DevToolsDiscoveryManager::HandleNewTargetCommand(
+DevToolsDiscoveryManager::HandleCreateTargetCommand(
alex clarke (OOO till 29th) 2016/08/10 12:39:48 Maybe mention in the patch comment that we don't n
Eric Seckler 2016/08/10 12:57:06 Done.
base::DictionaryValue* command_dict) {
- int id;
+ int id, width, height;
std::string method;
std::string url;
const base::DictionaryValue* params_dict = nullptr;
@@ -78,11 +82,24 @@ DevToolsDiscoveryManager::HandleNewTargetCommand(
CreateNew(GURL(url));
if (!descriptor)
return nullptr;
+
+ // Set size of frame by resizing RWHV if available.
+ if (params_dict->GetInteger("width", &width) && width >= 0 &&
+ params_dict->GetInteger("height", &height) && height >= 0) {
+ scoped_refptr<DevToolsAgentHost> agent_host = descriptor->GetAgentHost();
+ WebContents* web_contents =
+ agent_host ? agent_host->GetWebContents() : nullptr;
+ RenderWidgetHostView* view =
+ web_contents ? web_contents->GetRenderWidgetHostView() : nullptr;
+ if (view)
+ view->SetSize(gfx::Size(width, height));
+ }
+
std::unique_ptr<base::DictionaryValue> result(new base::DictionaryValue());
result->SetInteger("id", id);
std::unique_ptr<base::DictionaryValue> cmd_result(
new base::DictionaryValue());
- cmd_result->SetString("pageId", descriptor->GetId());
+ cmd_result->SetString("targetId", descriptor->GetId());
result->Set("result", std::move(cmd_result));
return result;
}

Powered by Google App Engine
This is Rietveld 408576698