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

Unified Diff: components/devtools_discovery/devtools_discovery_manager.cc

Issue 2119063002: Add commands to manage tabs and contexts to Browser Domain (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix name Created 4 years, 5 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 aaa998cba3c19ee997824c7868ea8c2a9526cf12..3233085aecb88d9d8538205f0b0b6b1113b0df32 100644
--- a/components/devtools_discovery/devtools_discovery_manager.cc
+++ b/components/devtools_discovery/devtools_discovery_manager.cc
@@ -62,4 +62,31 @@ DevToolsDiscoveryManager::GetDescriptorsFromProviders() {
return result;
}
+std::unique_ptr<base::DictionaryValue>
+DevToolsDiscoveryManager::HandleNewTargetCommand(
+ 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", &params_dict) &&
+ params_dict->GetString("initialUrl", &initial_url)) {
+ std::unique_ptr<devtools_discovery::DevToolsTargetDescriptor> descriptor =
+ CreateNew(GURL(initial_url));
+ if (!descriptor)
+ return nullptr;
+ 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

Powered by Google App Engine
This is Rietveld 408576698