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 aaa998cba3c19ee997824c7868ea8c2a9526cf12..989af785e0554b96fe809d24c8c56bcfba6565d2 100644 |
--- a/components/devtools_discovery/devtools_discovery_manager.cc |
+++ b/components/devtools_discovery/devtools_discovery_manager.cc |
@@ -62,4 +62,29 @@ DevToolsDiscoveryManager::GetDescriptorsFromProviders() { |
return result; |
} |
+std::unique_ptr<base::DictionaryValue> |
+DevToolsDiscoveryManager::MaybeHandleNewPageCommand( |
+ base::DictionaryValue* command_dict) { |
+ int id; |
+ std::string method; |
+ std::string initial_url; |
+ const base::DictionaryValue* params_dict = nullptr; |
+ if (command_dict->GetInteger("id", &id) && |
+ command_dict->GetString("method", &method) && |
+ method == "Browser.newPage" && |
+ command_dict->GetDictionary("params", ¶ms_dict) && |
+ params_dict->GetString("initialUrl", &initial_url)) { |
+ std::unique_ptr<devtools_discovery::DevToolsTargetDescriptor> descriptor = |
+ CreateNew(GURL(initial_url)); |
+ 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()); |
+ result->Set("result", std::move(cmd_result)); |
+ return result; |
+ } |
+ return nullptr; |
+} |
+ |
} // namespace devtools_discovery |