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

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: Changes for Sami 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..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", &params_dict) &&
+ params_dict->GetString("initialUrl", &initial_url)) {
+ std::unique_ptr<devtools_discovery::DevToolsTargetDescriptor> descriptor =
+ CreateNew(GURL(initial_url));
dgozman 2016/07/06 18:33:30 CreateNew may return nullptr.
alex clarke (OOO till 29th) 2016/07/06 20:25:06 Good point, thanks.
+ 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