| 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(
|
| 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;
|
| }
|
|
|