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

Unified Diff: components/devtools_discovery/devtools_discovery_manager.cc

Issue 2272213003: DevTools: remove devtools_discovery (merged into content). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fix 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
deleted file mode 100644
index eb2c5960ea1334f499e929174136fc1a27c0c4db..0000000000000000000000000000000000000000
--- a/components/devtools_discovery/devtools_discovery_manager.cc
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/devtools_discovery/devtools_discovery_manager.h"
-
-#include "base/stl_util.h"
-
-using content::DevToolsAgentHost;
-
-namespace devtools_discovery {
-
-// static
-DevToolsDiscoveryManager* DevToolsDiscoveryManager::GetInstance() {
- return base::Singleton<DevToolsDiscoveryManager>::get();
-}
-
-DevToolsDiscoveryManager::DevToolsDiscoveryManager() {
-}
-
-DevToolsDiscoveryManager::~DevToolsDiscoveryManager() {
- base::STLDeleteElements(&providers_);
-}
-
-void DevToolsDiscoveryManager::AddProvider(std::unique_ptr<Provider> provider) {
- providers_.push_back(provider.release());
-}
-
-content::DevToolsAgentHost::List DevToolsDiscoveryManager::GetDescriptors() {
- if (providers_.size())
- return GetDescriptorsFromProviders();
-
- return DevToolsAgentHost::GetOrCreateAll();
-}
-
-void DevToolsDiscoveryManager::SetCreateCallback(
- const CreateCallback& callback) {
- create_callback_ = callback;
-}
-
-scoped_refptr<content::DevToolsAgentHost> DevToolsDiscoveryManager::CreateNew(
- const GURL& url) {
- if (create_callback_.is_null())
- return nullptr;
- return create_callback_.Run(url);
-}
-
-content::DevToolsAgentHost::List
-DevToolsDiscoveryManager::GetDescriptorsFromProviders() {
- content::DevToolsAgentHost::List result;
- for (auto* provider : providers_) {
- content::DevToolsAgentHost::List partial = provider->GetDescriptors();
- result.insert(result.begin(), partial.begin(), partial.end());
- }
- return result;
-}
-
-std::unique_ptr<base::DictionaryValue>
-DevToolsDiscoveryManager::HandleCreateTargetCommand(
- base::DictionaryValue* command_dict) {
- int id;
- std::string method;
- std::string url;
- const base::DictionaryValue* params_dict = nullptr;
- if (command_dict->GetInteger("id", &id) &&
- command_dict->GetString("method", &method) &&
- method == "Browser.createTarget" &&
- command_dict->GetDictionary("params", &params_dict) &&
- params_dict->GetString("url", &url)) {
- scoped_refptr<content::DevToolsAgentHost> host = CreateNew(GURL(url));
- if (!host)
- 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("targetId", host->GetId());
- result->Set("result", std::move(cmd_result));
- return result;
- }
- return nullptr;
-}
-
-} // namespace devtools_discovery
« no previous file with comments | « components/devtools_discovery/devtools_discovery_manager.h ('k') | components/devtools_http_handler/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698