diff options
author | dgozman <dgozman@chromium.org> | 2015-04-22 10:48:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-22 17:50:20 +0000 |
commit | f72001505b06d68f7716b474e35865f33fffd4fe (patch) | |
tree | 9f1b9df53a2e40048e6e81afec51fb8c6a3db6e7 | |
parent | 17c796f5d0df5855f9788d6b12d83ddcff309f10 (diff) | |
download | chromium_src-f72001505b06d68f7716b474e35865f33fffd4fe.zip chromium_src-f72001505b06d68f7716b474e35865f33fffd4fe.tar.gz chromium_src-f72001505b06d68f7716b474e35865f33fffd4fe.tar.bz2 |
Created devtools_discovery component.
New discovery is used in content shell, extensions and chromecast. Once all embedders migrate to devtools_discovery, DevToolsTarget will be removed from content.
BUG=476496
Review URL: https://codereview.chromium.org/1056343004
Cr-Commit-Position: refs/heads/master@{#326337}
22 files changed, 324 insertions, 130 deletions
diff --git a/chromecast/browser/DEPS b/chromecast/browser/DEPS index e91498e..5306642 100644 --- a/chromecast/browser/DEPS +++ b/chromecast/browser/DEPS @@ -4,6 +4,7 @@ include_rules = [ "+cc/base/switches.h", "+chromecast", "+components/crash", + "+components/devtools_discovery", "+components/devtools_http_handler", "+components/network_hints/browser", "+content/public/browser", diff --git a/chromecast/browser/devtools/cast_dev_tools_delegate.cc b/chromecast/browser/devtools/cast_dev_tools_delegate.cc index d5bbf17..4144727 100644 --- a/chromecast/browser/devtools/cast_dev_tools_delegate.cc +++ b/chromecast/browser/devtools/cast_dev_tools_delegate.cc @@ -7,6 +7,7 @@ #include "base/files/file_path.h" #include "base/macros.h" #include "base/strings/utf_string_conversions.h" +#include "components/devtools_discovery/devtools_discovery_manager.h" #include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/devtools_target.h" #include "content/public/browser/favicon_status.h" @@ -20,67 +21,6 @@ namespace chromecast { namespace shell { -namespace { - -const char kTargetTypePage[] = "page"; -const char kTargetTypeServiceWorker[] = "service_worker"; -const char kTargetTypeSharedWorker[] = "worker"; -const char kTargetTypeOther[] = "other"; - -class Target : public content::DevToolsTarget { - public: - explicit Target(scoped_refptr<content::DevToolsAgentHost> agent_host); - - std::string GetId() const override { return agent_host_->GetId(); } - std::string GetParentId() const override { return std::string(); } - std::string GetType() const override { - switch (agent_host_->GetType()) { - case content::DevToolsAgentHost::TYPE_WEB_CONTENTS: - return kTargetTypePage; - case content::DevToolsAgentHost::TYPE_SERVICE_WORKER: - return kTargetTypeServiceWorker; - case content::DevToolsAgentHost::TYPE_SHARED_WORKER: - return kTargetTypeSharedWorker; - default: - break; - } - return kTargetTypeOther; - } - std::string GetTitle() const override { return agent_host_->GetTitle(); } - std::string GetDescription() const override { return std::string(); } - GURL GetURL() const override { return agent_host_->GetURL(); } - GURL GetFaviconURL() const override { return favicon_url_; } - base::TimeTicks GetLastActivityTime() const override { - return last_activity_time_; - } - bool IsAttached() const override { return agent_host_->IsAttached(); } - scoped_refptr<content::DevToolsAgentHost> GetAgentHost() const override { - return agent_host_; - } - bool Activate() const override { return agent_host_->Activate(); } - bool Close() const override { return agent_host_->Close(); } - - private: - scoped_refptr<content::DevToolsAgentHost> agent_host_; - GURL favicon_url_; - base::TimeTicks last_activity_time_; - - DISALLOW_COPY_AND_ASSIGN(Target); -}; - -Target::Target(scoped_refptr<content::DevToolsAgentHost> agent_host) - : agent_host_(agent_host) { - if (content::WebContents* web_contents = agent_host_->GetWebContents()) { - content::NavigationController& controller = web_contents->GetController(); - content::NavigationEntry* entry = controller.GetActiveEntry(); - if (entry != NULL && entry->GetURL().is_valid()) - favicon_url_ = entry->GetFavicon().url; - last_activity_time_ = web_contents->GetLastActiveTime(); - } -} - -} // namespace - // CastDevToolsDelegate ----------------------------------------------------- CastDevToolsDelegate::CastDevToolsDelegate() { @@ -129,12 +69,10 @@ CastDevToolsManagerDelegate::CreateNewTarget(const GURL& url) { void CastDevToolsManagerDelegate::EnumerateTargets(TargetCallback callback) { TargetList targets; - content::DevToolsAgentHost::List agents = - content::DevToolsAgentHost::GetOrCreateAll(); - for (content::DevToolsAgentHost::List::iterator it = agents.begin(); - it != agents.end(); ++it) { - targets.push_back(new Target(*it)); - } + devtools_discovery::DevToolsDiscoveryManager* discovery_manager = + devtools_discovery::DevToolsDiscoveryManager::GetInstance(); + for (const auto& descriptor : discovery_manager->GetDescriptors()) + targets.push_back(descriptor); callback.Run(targets); } diff --git a/chromecast/chromecast.gyp b/chromecast/chromecast.gyp index b9198ac..f6056b0 100644 --- a/chromecast/chromecast.gyp +++ b/chromecast/chromecast.gyp @@ -188,6 +188,7 @@ '../components/components.gyp:cdm_renderer', '../components/components.gyp:component_metrics_proto', '../components/components.gyp:crash_component', + '../components/components.gyp:devtools_discovery', '../components/components.gyp:devtools_http_handler', '../components/components.gyp:network_hints_browser', '../components/components.gyp:network_hints_renderer', diff --git a/components/BUILD.gn b/components/BUILD.gn index ee6bca2..95761c1 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn @@ -36,6 +36,7 @@ group("all_components") { "//components/data_reduction_proxy/core/browser", "//components/data_reduction_proxy/core/common", "//components/device_event_log", + "//components/devtools_discovery", "//components/devtools_http_handler", "//components/dom_distiller/core", "//components/domain_reliability", diff --git a/components/OWNERS b/components/OWNERS index 05b239f..296d144 100644 --- a/components/OWNERS +++ b/components/OWNERS @@ -58,6 +58,9 @@ per-file data_reduction_proxy*=jeremyim@chromium.org per-file devtools_bridge.gyp=mnaganov@chromium.org per-file devtools_bridge.gyp=serya@chromium.org +per-file devtools_discovery.gyp*=dgozman@chromium.org +per-file devtools_discovery.gyp*=pfeldman@chromium.org + per-file devtools_http_handler.gyp*=dgozman@chromium.org per-file devtools_http_handler.gyp*=pfeldman@chromium.org diff --git a/components/components.gyp b/components/components.gyp index 9327c97..3f6eb49 100644 --- a/components/components.gyp +++ b/components/components.gyp @@ -88,6 +88,7 @@ 'app_modal.gypi', 'browsing_data.gypi', 'cdm.gypi', + 'devtools_discovery.gypi', 'devtools_http_handler.gypi', 'navigation_interception.gypi', 'power.gypi', diff --git a/components/devtools_discovery.gypi b/components/devtools_discovery.gypi new file mode 100644 index 0000000..9b8232c --- /dev/null +++ b/components/devtools_discovery.gypi @@ -0,0 +1,27 @@ +# 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. + +{ + 'targets': [ + { + 'target_name': 'devtools_discovery', + 'type': 'static_library', + 'dependencies': [ + '../base/base.gyp:base', + '../content/content.gyp:content_browser', + '../content/content.gyp:content_common', + ], + 'include_dirs': [ + '..', + ], + 'sources': [ + 'devtools_discovery/basic_target_descriptor.cc', + 'devtools_discovery/basic_target_descriptor.h', + 'devtools_discovery/devtools_discovery_manager.cc', + 'devtools_discovery/devtools_discovery_manager.h', + 'devtools_discovery/devtools_target_descriptor.h', + ], + }, + ], +} diff --git a/components/devtools_discovery/BUILD.gn b/components/devtools_discovery/BUILD.gn new file mode 100644 index 0000000..a733af4 --- /dev/null +++ b/components/devtools_discovery/BUILD.gn @@ -0,0 +1,19 @@ +# 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. + +source_set("devtools_discovery") { + sources = [ + "basic_target_descriptor.cc", + "basic_target_descriptor.h", + "devtools_discovery_manager.cc", + "devtools_discovery_manager.h", + "devtools_target_descriptor.h", + ] + + deps = [ + "//base", + "//content/public/browser", + "//content/public/common", + ] +} diff --git a/components/devtools_discovery/DEPS b/components/devtools_discovery/DEPS new file mode 100644 index 0000000..f75ba96 --- /dev/null +++ b/components/devtools_discovery/DEPS @@ -0,0 +1,5 @@ +include_rules = [ + "+content/public/browser", + "+content/public/common", + "+content/public/test", +] diff --git a/components/devtools_discovery/OWNERS b/components/devtools_discovery/OWNERS new file mode 100644 index 0000000..fe38b0f --- /dev/null +++ b/components/devtools_discovery/OWNERS @@ -0,0 +1,2 @@ +dgozman@chromium.org +pfeldman@chromium.org diff --git a/components/devtools_discovery/basic_target_descriptor.cc b/components/devtools_discovery/basic_target_descriptor.cc new file mode 100644 index 0000000..bbb62d0 --- /dev/null +++ b/components/devtools_discovery/basic_target_descriptor.cc @@ -0,0 +1,94 @@ +// 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/basic_target_descriptor.h" + +#include "content/public/browser/devtools_agent_host.h" +#include "content/public/browser/favicon_status.h" +#include "content/public/browser/navigation_entry.h" +#include "content/public/browser/web_contents.h" + +using content::DevToolsAgentHost; + +namespace devtools_discovery { + +const char BasicTargetDescriptor::kTypePage[] = "page"; +const char BasicTargetDescriptor::kTypeServiceWorker[] = "service_worker"; +const char BasicTargetDescriptor::kTypeSharedWorker[] = "worker"; +const char BasicTargetDescriptor::kTypeOther[] = "other"; + +BasicTargetDescriptor::BasicTargetDescriptor( + scoped_refptr<DevToolsAgentHost> agent_host) + : agent_host_(agent_host) { + if (content::WebContents* web_contents = agent_host_->GetWebContents()) { + content::NavigationController& controller = web_contents->GetController(); + content::NavigationEntry* entry = controller.GetActiveEntry(); + if (entry != NULL && entry->GetURL().is_valid()) + favicon_url_ = entry->GetFavicon().url; + last_activity_time_ = web_contents->GetLastActiveTime(); + } +} + +BasicTargetDescriptor::~BasicTargetDescriptor() { +} + +std::string BasicTargetDescriptor::GetId() const { + return agent_host_->GetId(); +} + +std::string BasicTargetDescriptor::GetParentId() const { + return std::string(); +} + +std::string BasicTargetDescriptor::GetType() const { + switch (agent_host_->GetType()) { + case DevToolsAgentHost::TYPE_WEB_CONTENTS: + return kTypePage; + case DevToolsAgentHost::TYPE_SERVICE_WORKER: + return kTypeServiceWorker; + case DevToolsAgentHost::TYPE_SHARED_WORKER: + return kTypeSharedWorker; + default: + break; + } + return kTypeOther; +} + +std::string BasicTargetDescriptor::GetTitle() const { + return agent_host_->GetTitle(); +} + +std::string BasicTargetDescriptor::GetDescription() const { + return std::string(); +} + +GURL BasicTargetDescriptor::GetURL() const { + return agent_host_->GetURL(); +} + +GURL BasicTargetDescriptor::GetFaviconURL() const { + return favicon_url_; +} + +base::TimeTicks BasicTargetDescriptor::GetLastActivityTime() const { + return last_activity_time_; +} + +bool BasicTargetDescriptor::IsAttached() const { + return agent_host_->IsAttached(); +} + +scoped_refptr<DevToolsAgentHost> BasicTargetDescriptor::GetAgentHost() const { + return agent_host_; +} + +bool BasicTargetDescriptor::Activate() const { + return agent_host_->Activate(); +} + +bool BasicTargetDescriptor::Close() const { + return agent_host_->Close(); +} + +} // namespace devtools_discovery diff --git a/components/devtools_discovery/basic_target_descriptor.h b/components/devtools_discovery/basic_target_descriptor.h new file mode 100644 index 0000000..9072e0f --- /dev/null +++ b/components/devtools_discovery/basic_target_descriptor.h @@ -0,0 +1,45 @@ +// 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. + +#ifndef COMPONENTS_DEVTOOLS_DISCOVERY_BASIC_TARGET_DESCRIPTOR_H_ +#define COMPONENTS_DEVTOOLS_DISCOVERY_BASIC_TARGET_DESCRIPTOR_H_ + +#include "components/devtools_discovery/devtools_target_descriptor.h" + +namespace devtools_discovery { + +class BasicTargetDescriptor : public DevToolsTargetDescriptor { + public: + explicit BasicTargetDescriptor( + scoped_refptr<content::DevToolsAgentHost> agent_host); + ~BasicTargetDescriptor() override; + + static const char kTypePage[]; + static const char kTypeServiceWorker[]; + static const char kTypeSharedWorker[]; + static const char kTypeOther[]; + + // DevToolsTargetDescriptor implementation. + std::string GetId() const override; + std::string GetParentId() const override; + std::string GetType() const override; + std::string GetTitle() const override; + std::string GetDescription() const override; + GURL GetURL() const override; + GURL GetFaviconURL() const override; + base::TimeTicks GetLastActivityTime() const override; + bool IsAttached() const override; + scoped_refptr<content::DevToolsAgentHost> GetAgentHost() const override; + bool Activate() const override; + bool Close() const override; + + private: + scoped_refptr<content::DevToolsAgentHost> agent_host_; + GURL favicon_url_; + base::TimeTicks last_activity_time_; +}; + +} // namespace devtools_discovery + +#endif // COMPONENTS_DEVTOOLS_DISCOVERY_BASIC_TARGET_DESCRIPTOR_H_ diff --git a/components/devtools_discovery/devtools_discovery_manager.cc b/components/devtools_discovery/devtools_discovery_manager.cc new file mode 100644 index 0000000..1dcecc2 --- /dev/null +++ b/components/devtools_discovery/devtools_discovery_manager.cc @@ -0,0 +1,34 @@ +// 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 "components/devtools_discovery/basic_target_descriptor.h" +#include "content/public/browser/devtools_agent_host.h" + +using content::DevToolsAgentHost; + +namespace devtools_discovery { + +// static +DevToolsDiscoveryManager* DevToolsDiscoveryManager::GetInstance() { + return Singleton<DevToolsDiscoveryManager>::get(); +} + +DevToolsDiscoveryManager::DevToolsDiscoveryManager() { +} + +DevToolsDiscoveryManager::~DevToolsDiscoveryManager() { +} + +DevToolsTargetDescriptor::List DevToolsDiscoveryManager::GetDescriptors() { + DevToolsAgentHost::List agent_hosts = DevToolsAgentHost::GetOrCreateAll(); + DevToolsTargetDescriptor::List result; + result.reserve(agent_hosts.size()); + for (const auto& agent_host : agent_hosts) + result.push_back(new BasicTargetDescriptor(agent_host)); + return result; +} + +} // namespace devtools_discovery diff --git a/components/devtools_discovery/devtools_discovery_manager.h b/components/devtools_discovery/devtools_discovery_manager.h new file mode 100644 index 0000000..764d48f --- /dev/null +++ b/components/devtools_discovery/devtools_discovery_manager.h @@ -0,0 +1,35 @@ +// 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. + +#ifndef COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_ +#define COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_ + +#include <string> + +#include "base/memory/scoped_ptr.h" +#include "base/memory/singleton.h" +#include "components/devtools_discovery/devtools_target_descriptor.h" + +namespace devtools_discovery { + +class DevToolsDiscoveryManager { + public: + // Returns single instance of this class. The instance is destroyed on the + // browser main loop exit so this method MUST NOT be called after that point. + static DevToolsDiscoveryManager* GetInstance(); + + DevToolsTargetDescriptor::List GetDescriptors(); + + private: + friend struct DefaultSingletonTraits<DevToolsDiscoveryManager>; + + DevToolsDiscoveryManager(); + ~DevToolsDiscoveryManager(); + + DISALLOW_COPY_AND_ASSIGN(DevToolsDiscoveryManager); +}; + +} // namespace devtools_discovery + +#endif // COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_DISCOVERY_MANAGER_H_ diff --git a/components/devtools_discovery/devtools_target_descriptor.h b/components/devtools_discovery/devtools_target_descriptor.h new file mode 100644 index 0000000..2e5b104 --- /dev/null +++ b/components/devtools_discovery/devtools_target_descriptor.h @@ -0,0 +1,37 @@ +// 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. + +#ifndef COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_TARGET_DESCRIPTOR_H_ +#define COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_TARGET_DESCRIPTOR_H_ + +#include <string> +#include <vector> + +#include "base/basictypes.h" +#include "base/memory/ref_counted.h" +#include "base/time/time.h" +#include "content/public/browser/devtools_target.h" +#include "url/gurl.h" + +namespace content { +class DevToolsAgentHost; +} + +namespace devtools_discovery { + +// DevToolsTargetDescriptor provides information about devtools target +// and can be used to manipulate the target and query its details. +// Instantiation and discovery of DevToolsTargetDescriptor instances +// is the responsibility of DevToolsDiscoveryManager. +// TODO(dgozman): remove content::DevToolsTarget once every embedder migrates +// to this descriptor. +class DevToolsTargetDescriptor : public content::DevToolsTarget { + public: + using List = std::vector<DevToolsTargetDescriptor*>; + ~DevToolsTargetDescriptor() override {} +}; + +} // namespace devtools_discovery + +#endif // COMPONENTS_DEVTOOLS_DISCOVERY_DEVTOOLS_TARGET_DESCRIPTOR_H_ diff --git a/content/content_shell.gypi b/content/content_shell.gypi index 4931f11..20835bd 100644 --- a/content/content_shell.gypi +++ b/content/content_shell.gypi @@ -47,6 +47,7 @@ '../cc/blink/cc_blink.gyp:cc_blink', '../cc/cc.gyp:cc', '../components/components.gyp:crash_component_breakpad_mac_to_be_deleted', + '../components/components.gyp:devtools_discovery', '../components/components.gyp:devtools_http_handler', '../components/components.gyp:web_cache_renderer', '../device/bluetooth/bluetooth.gyp:device_bluetooth', diff --git a/content/shell/BUILD.gn b/content/shell/BUILD.gn index e1d9b11..08a5e56 100644 --- a/content/shell/BUILD.gn +++ b/content/shell/BUILD.gn @@ -249,6 +249,7 @@ static_library("content_shell_lib") { "//base/third_party/dynamic_annotations", "//cc", "//components/crash/app", + "//components/devtools_discovery", "//components/devtools_http_handler", "//components/web_cache/renderer", "//content:resources", diff --git a/content/shell/DEPS b/content/shell/DEPS index 44638c3..552ba8e 100644 --- a/content/shell/DEPS +++ b/content/shell/DEPS @@ -24,6 +24,7 @@ include_rules = [ "+ui/views", "+components/crash", + "+components/devtools_discovery", "+components/devtools_http_handler", # For enabling media related features. diff --git a/content/shell/browser/shell_devtools_manager_delegate.cc b/content/shell/browser/shell_devtools_manager_delegate.cc index 8011145..5384e39 100644 --- a/content/shell/browser/shell_devtools_manager_delegate.cc +++ b/content/shell/browser/shell_devtools_manager_delegate.cc @@ -12,6 +12,8 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" +#include "components/devtools_discovery/basic_target_descriptor.h" +#include "components/devtools_discovery/devtools_discovery_manager.h" #include "components/devtools_http_handler/devtools_http_handler.h" #include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/devtools_frontend_host.h" @@ -45,9 +47,6 @@ namespace { const char kFrontEndURL[] = "http://chrome-devtools-frontend.appspot.com/serve_rev/%s/inspector.html"; #endif -const char kTargetTypePage[] = "page"; -const char kTargetTypeServiceWorker[] = "service_worker"; -const char kTargetTypeOther[] = "other"; const int kBackLog = 10; @@ -133,62 +132,6 @@ CreateSocketFactory() { #endif } -class Target : public DevToolsTarget { - public: - explicit Target(scoped_refptr<DevToolsAgentHost> agent_host); - - std::string GetId() const override { return agent_host_->GetId(); } - std::string GetParentId() const override { return std::string(); } - std::string GetType() const override { - switch (agent_host_->GetType()) { - case DevToolsAgentHost::TYPE_WEB_CONTENTS: - return kTargetTypePage; - case DevToolsAgentHost::TYPE_SERVICE_WORKER: - return kTargetTypeServiceWorker; - default: - break; - } - return kTargetTypeOther; - } - std::string GetTitle() const override { return agent_host_->GetTitle(); } - std::string GetDescription() const override { return std::string(); } - GURL GetURL() const override { return agent_host_->GetURL(); } - GURL GetFaviconURL() const override { return favicon_url_; } - base::TimeTicks GetLastActivityTime() const override { - return last_activity_time_; - } - bool IsAttached() const override { return agent_host_->IsAttached(); } - scoped_refptr<DevToolsAgentHost> GetAgentHost() const override { - return agent_host_; - } - bool Activate() const override; - bool Close() const override; - - private: - scoped_refptr<DevToolsAgentHost> agent_host_; - GURL favicon_url_; - base::TimeTicks last_activity_time_; -}; - -Target::Target(scoped_refptr<DevToolsAgentHost> agent_host) - : agent_host_(agent_host) { - if (WebContents* web_contents = agent_host_->GetWebContents()) { - NavigationController& controller = web_contents->GetController(); - NavigationEntry* entry = controller.GetActiveEntry(); - if (entry != NULL && entry->GetURL().is_valid()) - favicon_url_ = entry->GetFavicon().url; - last_activity_time_ = web_contents->GetLastActiveTime(); - } -} - -bool Target::Activate() const { - return agent_host_->Activate(); -} - -bool Target::Close() const { - return agent_host_->Close(); -} - // ShellDevToolsDelegate ---------------------------------------------------- class ShellDevToolsDelegate : @@ -277,14 +220,16 @@ ShellDevToolsManagerDelegate::CreateNewTarget(const GURL& url) { NULL, gfx::Size()); return scoped_ptr<DevToolsTarget>( - new Target(DevToolsAgentHost::GetOrCreateFor(shell->web_contents()))); + new devtools_discovery::BasicTargetDescriptor( + DevToolsAgentHost::GetOrCreateFor(shell->web_contents()))); } void ShellDevToolsManagerDelegate::EnumerateTargets(TargetCallback callback) { TargetList targets; - for (const auto& agent_host : DevToolsAgentHost::GetOrCreateAll()) { - targets.push_back(new Target(agent_host)); - } + devtools_discovery::DevToolsDiscoveryManager* discovery_manager = + devtools_discovery::DevToolsDiscoveryManager::GetInstance(); + for (const auto& descriptor : discovery_manager->GetDescriptors()) + targets.push_back(descriptor); callback.Run(targets); } diff --git a/extensions/shell/BUILD.gn b/extensions/shell/BUILD.gn index 64accfc..b7bf9ce 100644 --- a/extensions/shell/BUILD.gn +++ b/extensions/shell/BUILD.gn @@ -31,6 +31,7 @@ source_set("app_shell_lib") { ":version_header", "//base", "//base:prefs", + "//components/devtools_discovery", "//components/devtools_http_handler", "//components/pref_registry", "//components/update_client", diff --git a/extensions/shell/app_shell.gyp b/extensions/shell/app_shell.gyp index 466637d..25bd151 100644 --- a/extensions/shell/app_shell.gyp +++ b/extensions/shell/app_shell.gyp @@ -22,6 +22,7 @@ 'app_shell_version_header', '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/base.gyp:base_prefs', + '<(DEPTH)/components/components.gyp:devtools_discovery', '<(DEPTH)/components/components.gyp:devtools_http_handler', '<(DEPTH)/components/components.gyp:pref_registry', '<(DEPTH)/components/components.gyp:update_client', diff --git a/extensions/shell/browser/DEPS b/extensions/shell/browser/DEPS index 43dda94..03437fd 100644 --- a/extensions/shell/browser/DEPS +++ b/extensions/shell/browser/DEPS @@ -1,5 +1,6 @@ include_rules = [ "+chromeos", + "+components/devtools_discovery", "+components/devtools_http_handler", "+components/keyed_service", "+components/nacl/browser", |