[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 5 | #include "content/shell/browser/shell_devtools_manager_delegate.h" |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 6 | |
[email protected] | 90e6c541 | 2013-04-16 22:45:25 | [diff] [blame] | 7 | #include <vector> |
| 8 | |
[email protected] | ed6635e | 2012-10-27 00:44:09 | [diff] [blame] | 9 | #include "base/bind.h" |
[email protected] | 90e6c541 | 2013-04-16 22:45:25 | [diff] [blame] | 10 | #include "base/command_line.h" |
[email protected] | 0e60fce | 2014-06-04 22:27:20 | [diff] [blame] | 11 | #include "base/files/file_path.h" |
[email protected] | 90e6c541 | 2013-04-16 22:45:25 | [diff] [blame] | 12 | #include "base/strings/string_number_conversions.h" |
[email protected] | 8dffd2c | 2013-12-02 14:14:38 | [diff] [blame] | 13 | #include "base/strings/stringprintf.h" |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 14 | #include "base/strings/utf_string_conversions.h" |
| 15 | #include "content/public/browser/devtools_agent_host.h" |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 16 | #include "content/public/browser/devtools_http_handler.h" |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 17 | #include "content/public/browser/devtools_target.h" |
| 18 | #include "content/public/browser/favicon_status.h" |
| 19 | #include "content/public/browser/navigation_entry.h" |
| 20 | #include "content/public/browser/render_view_host.h" |
[email protected] | eb04099 | 2012-10-10 16:56:00 | [diff] [blame] | 21 | #include "content/public/browser/web_contents.h" |
[email protected] | 90e6c541 | 2013-04-16 22:45:25 | [diff] [blame] | 22 | #include "content/public/common/content_switches.h" |
[email protected] | eb04099 | 2012-10-10 16:56:00 | [diff] [blame] | 23 | #include "content/public/common/url_constants.h" |
[email protected] | efd2c3f | 2014-03-11 09:57:25 | [diff] [blame] | 24 | #include "content/public/common/user_agent.h" |
[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame] | 25 | #include "content/shell/browser/shell.h" |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 26 | #include "grit/shell_resources.h" |
vkuzkokov | 7942676 | 2015-01-13 08:03:00 | [diff] [blame^] | 27 | #include "net/base/net_errors.h" |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 28 | #include "net/socket/tcp_server_socket.h" |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 29 | #include "ui/base/resource/resource_bundle.h" |
| 30 | |
[email protected] | ed6635e | 2012-10-27 00:44:09 | [diff] [blame] | 31 | #if defined(OS_ANDROID) |
| 32 | #include "content/public/browser/android/devtools_auth.h" |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 33 | #include "net/socket/unix_domain_server_socket_posix.h" |
[email protected] | 90e6c541 | 2013-04-16 22:45:25 | [diff] [blame] | 34 | #endif |
[email protected] | ed6635e | 2012-10-27 00:44:09 | [diff] [blame] | 35 | |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 36 | namespace content { |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 37 | |
[email protected] | ed6635e | 2012-10-27 00:44:09 | [diff] [blame] | 38 | namespace { |
[email protected] | 90e6c541 | 2013-04-16 22:45:25 | [diff] [blame] | 39 | |
[email protected] | 8dffd2c | 2013-12-02 14:14:38 | [diff] [blame] | 40 | #if defined(OS_ANDROID) |
| 41 | const char kFrontEndURL[] = |
dgozman | a1409c4 | 2014-11-19 16:06:12 | [diff] [blame] | 42 | "http://chrome-devtools-frontend.appspot.com/serve_rev/%s/inspector.html"; |
[email protected] | 8dffd2c | 2013-12-02 14:14:38 | [diff] [blame] | 43 | #endif |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 44 | const char kTargetTypePage[] = "page"; |
vkuzkokov | e1133eb | 2014-08-25 13:33:16 | [diff] [blame] | 45 | const char kTargetTypeServiceWorker[] = "service_worker"; |
| 46 | const char kTargetTypeOther[] = "other"; |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 47 | |
vkuzkokov | 7942676 | 2015-01-13 08:03:00 | [diff] [blame^] | 48 | const int kBackLog = 10; |
| 49 | |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 50 | #if defined(OS_ANDROID) |
| 51 | class UnixDomainServerSocketFactory |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 52 | : public DevToolsHttpHandler::ServerSocketFactory { |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 53 | public: |
| 54 | explicit UnixDomainServerSocketFactory(const std::string& socket_name) |
vkuzkokov | 7942676 | 2015-01-13 08:03:00 | [diff] [blame^] | 55 | : socket_name_(socket_name) {} |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 56 | |
| 57 | private: |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 58 | // DevToolsHttpHandler::ServerSocketFactory. |
vkuzkokov | 7942676 | 2015-01-13 08:03:00 | [diff] [blame^] | 59 | virtual scoped_ptr<net::ServerSocket> CreateForHttpServer() override { |
| 60 | scoped_ptr<net::ServerSocket> socket( |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 61 | new net::UnixDomainServerSocket( |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 62 | base::Bind(&CanUserConnectToDevTools), |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 63 | true /* use_abstract_namespace */)); |
vkuzkokov | 7942676 | 2015-01-13 08:03:00 | [diff] [blame^] | 64 | if (socket->ListenWithAddressAndPort(socket_name_, 0, kBackLog) != net::OK) |
| 65 | return scoped_ptr<net::ServerSocket>(); |
| 66 | |
| 67 | return socket; |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 68 | } |
| 69 | |
vkuzkokov | 7942676 | 2015-01-13 08:03:00 | [diff] [blame^] | 70 | std::string socket_name_; |
| 71 | |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 72 | DISALLOW_COPY_AND_ASSIGN(UnixDomainServerSocketFactory); |
| 73 | }; |
| 74 | #else |
| 75 | class TCPServerSocketFactory |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 76 | : public DevToolsHttpHandler::ServerSocketFactory { |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 77 | public: |
vkuzkokov | 7942676 | 2015-01-13 08:03:00 | [diff] [blame^] | 78 | TCPServerSocketFactory(const std::string& address, uint16 port) |
| 79 | : address_(address), port_(port) { |
| 80 | } |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 81 | |
| 82 | private: |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 83 | // DevToolsHttpHandler::ServerSocketFactory. |
vkuzkokov | 7942676 | 2015-01-13 08:03:00 | [diff] [blame^] | 84 | scoped_ptr<net::ServerSocket> CreateForHttpServer() override { |
| 85 | scoped_ptr<net::ServerSocket> socket( |
| 86 | new net::TCPServerSocket(nullptr, net::NetLog::Source())); |
| 87 | if (socket->ListenWithAddressAndPort(address_, port_, kBackLog) != net::OK) |
| 88 | return scoped_ptr<net::ServerSocket>(); |
| 89 | |
| 90 | return socket; |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 91 | } |
| 92 | |
vkuzkokov | 7942676 | 2015-01-13 08:03:00 | [diff] [blame^] | 93 | std::string address_; |
| 94 | uint16 port_; |
| 95 | |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 96 | DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); |
| 97 | }; |
| 98 | #endif |
| 99 | |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 100 | scoped_ptr<DevToolsHttpHandler::ServerSocketFactory> |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 101 | CreateSocketFactory() { |
avi | 83883c8 | 2014-12-23 00:08:49 | [diff] [blame] | 102 | const base::CommandLine& command_line = |
| 103 | *base::CommandLine::ForCurrentProcess(); |
[email protected] | 90e6c541 | 2013-04-16 22:45:25 | [diff] [blame] | 104 | #if defined(OS_ANDROID) |
| 105 | std::string socket_name = "content_shell_devtools_remote"; |
| 106 | if (command_line.HasSwitch(switches::kRemoteDebuggingSocketName)) { |
| 107 | socket_name = command_line.GetSwitchValueASCII( |
| 108 | switches::kRemoteDebuggingSocketName); |
| 109 | } |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 110 | return scoped_ptr<DevToolsHttpHandler::ServerSocketFactory>( |
byungchul | 38c3ae7 | 2014-08-25 23:27:46 | [diff] [blame] | 111 | new UnixDomainServerSocketFactory(socket_name)); |
[email protected] | 90e6c541 | 2013-04-16 22:45:25 | [diff] [blame] | 112 | #else |
| 113 | // See if the user specified a port on the command line (useful for |
| 114 | // automation). If not, use an ephemeral port by specifying 0. |
pkasting | cba1329 | 2014-11-20 03:35:21 | [diff] [blame] | 115 | uint16 port = 0; |
[email protected] | 90e6c541 | 2013-04-16 22:45:25 | [diff] [blame] | 116 | if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) { |
| 117 | int temp_port; |
| 118 | std::string port_str = |
| 119 | command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort); |
| 120 | if (base::StringToInt(port_str, &temp_port) && |
| 121 | temp_port > 0 && temp_port < 65535) { |
pkasting | cba1329 | 2014-11-20 03:35:21 | [diff] [blame] | 122 | port = static_cast<uint16>(temp_port); |
[email protected] | 90e6c541 | 2013-04-16 22:45:25 | [diff] [blame] | 123 | } else { |
| 124 | DLOG(WARNING) << "Invalid http debugger port number " << temp_port; |
| 125 | } |
| 126 | } |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 127 | return scoped_ptr<DevToolsHttpHandler::ServerSocketFactory>( |
vkuzkokov | 7942676 | 2015-01-13 08:03:00 | [diff] [blame^] | 128 | new TCPServerSocketFactory("127.0.0.1", port)); |
[email protected] | ed6635e | 2012-10-27 00:44:09 | [diff] [blame] | 129 | #endif |
[email protected] | 90e6c541 | 2013-04-16 22:45:25 | [diff] [blame] | 130 | } |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 131 | |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 132 | class Target : public DevToolsTarget { |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 133 | public: |
vkuzkokov | e1133eb | 2014-08-25 13:33:16 | [diff] [blame] | 134 | explicit Target(scoped_refptr<DevToolsAgentHost> agent_host); |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 135 | |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 136 | std::string GetId() const override { return agent_host_->GetId(); } |
| 137 | std::string GetParentId() const override { return std::string(); } |
| 138 | std::string GetType() const override { |
vkuzkokov | e1133eb | 2014-08-25 13:33:16 | [diff] [blame] | 139 | switch (agent_host_->GetType()) { |
| 140 | case DevToolsAgentHost::TYPE_WEB_CONTENTS: |
| 141 | return kTargetTypePage; |
| 142 | case DevToolsAgentHost::TYPE_SERVICE_WORKER: |
| 143 | return kTargetTypeServiceWorker; |
| 144 | default: |
| 145 | break; |
| 146 | } |
| 147 | return kTargetTypeOther; |
| 148 | } |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 149 | std::string GetTitle() const override { return agent_host_->GetTitle(); } |
| 150 | std::string GetDescription() const override { return std::string(); } |
| 151 | GURL GetURL() const override { return agent_host_->GetURL(); } |
| 152 | GURL GetFaviconURL() const override { return favicon_url_; } |
| 153 | base::TimeTicks GetLastActivityTime() const override { |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 154 | return last_activity_time_; |
| 155 | } |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 156 | bool IsAttached() const override { return agent_host_->IsAttached(); } |
| 157 | scoped_refptr<DevToolsAgentHost> GetAgentHost() const override { |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 158 | return agent_host_; |
| 159 | } |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 160 | bool Activate() const override; |
| 161 | bool Close() const override; |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 162 | |
| 163 | private: |
| 164 | scoped_refptr<DevToolsAgentHost> agent_host_; |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 165 | GURL favicon_url_; |
| 166 | base::TimeTicks last_activity_time_; |
| 167 | }; |
| 168 | |
vkuzkokov | e1133eb | 2014-08-25 13:33:16 | [diff] [blame] | 169 | Target::Target(scoped_refptr<DevToolsAgentHost> agent_host) |
| 170 | : agent_host_(agent_host) { |
| 171 | if (WebContents* web_contents = agent_host_->GetWebContents()) { |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 172 | NavigationController& controller = web_contents->GetController(); |
| 173 | NavigationEntry* entry = controller.GetActiveEntry(); |
vkuzkokov | e1133eb | 2014-08-25 13:33:16 | [diff] [blame] | 174 | if (entry != NULL && entry->GetURL().is_valid()) |
| 175 | favicon_url_ = entry->GetFavicon().url; |
| 176 | last_activity_time_ = web_contents->GetLastActiveTime(); |
| 177 | } |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | bool Target::Activate() const { |
vkuzkokov | e1133eb | 2014-08-25 13:33:16 | [diff] [blame] | 181 | return agent_host_->Activate(); |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | bool Target::Close() const { |
vkuzkokov | e1133eb | 2014-08-25 13:33:16 | [diff] [blame] | 185 | return agent_host_->Close(); |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 186 | } |
| 187 | |
dgozman | 252e18d | 2014-09-22 12:40:06 | [diff] [blame] | 188 | // ShellDevToolsDelegate ---------------------------------------------------- |
| 189 | |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 190 | class ShellDevToolsDelegate : public DevToolsHttpHandlerDelegate { |
| 191 | public: |
| 192 | explicit ShellDevToolsDelegate(BrowserContext* browser_context); |
| 193 | ~ShellDevToolsDelegate() override; |
| 194 | |
| 195 | // DevToolsHttpHandlerDelegate implementation. |
| 196 | std::string GetDiscoveryPageHTML() override; |
| 197 | bool BundlesFrontendResources() override; |
| 198 | base::FilePath GetDebugFrontendDir() override; |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 199 | |
| 200 | private: |
| 201 | BrowserContext* browser_context_; |
| 202 | |
| 203 | DISALLOW_COPY_AND_ASSIGN(ShellDevToolsDelegate); |
| 204 | }; |
| 205 | |
[email protected] | 90e6c541 | 2013-04-16 22:45:25 | [diff] [blame] | 206 | ShellDevToolsDelegate::ShellDevToolsDelegate(BrowserContext* browser_context) |
[email protected] | eb04099 | 2012-10-10 16:56:00 | [diff] [blame] | 207 | : browser_context_(browser_context) { |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 208 | } |
| 209 | |
| 210 | ShellDevToolsDelegate::~ShellDevToolsDelegate() { |
| 211 | } |
| 212 | |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 213 | std::string ShellDevToolsDelegate::GetDiscoveryPageHTML() { |
[email protected] | 8dffd2c | 2013-12-02 14:14:38 | [diff] [blame] | 214 | #if defined(OS_ANDROID) |
| 215 | return std::string(); |
| 216 | #else |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 217 | return ResourceBundle::GetSharedInstance().GetRawDataResource( |
[email protected] | 4d8bb1a9 | 2012-11-01 21:12:40 | [diff] [blame] | 218 | IDR_CONTENT_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string(); |
[email protected] | 8dffd2c | 2013-12-02 14:14:38 | [diff] [blame] | 219 | #endif |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 220 | } |
| 221 | |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 222 | bool ShellDevToolsDelegate::BundlesFrontendResources() { |
[email protected] | 8dffd2c | 2013-12-02 14:14:38 | [diff] [blame] | 223 | #if defined(OS_ANDROID) |
| 224 | return false; |
| 225 | #else |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 226 | return true; |
[email protected] | 8dffd2c | 2013-12-02 14:14:38 | [diff] [blame] | 227 | #endif |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 228 | } |
| 229 | |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 230 | base::FilePath ShellDevToolsDelegate::GetDebugFrontendDir() { |
| 231 | return base::FilePath(); |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 232 | } |
| 233 | |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 234 | } // namespace |
| 235 | |
dgozman | 252e18d | 2014-09-22 12:40:06 | [diff] [blame] | 236 | // ShellDevToolsManagerDelegate ---------------------------------------------- |
| 237 | |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 238 | // static |
| 239 | DevToolsHttpHandler* |
| 240 | ShellDevToolsManagerDelegate::CreateHttpHandler( |
| 241 | BrowserContext* browser_context) { |
| 242 | std::string frontend_url; |
| 243 | #if defined(OS_ANDROID) |
| 244 | frontend_url = base::StringPrintf(kFrontEndURL, GetWebKitRevision().c_str()); |
| 245 | #endif |
| 246 | return DevToolsHttpHandler::Start(CreateSocketFactory(), |
| 247 | frontend_url, |
| 248 | new ShellDevToolsDelegate(browser_context), |
| 249 | base::FilePath()); |
| 250 | } |
| 251 | |
dgozman | 252e18d | 2014-09-22 12:40:06 | [diff] [blame] | 252 | ShellDevToolsManagerDelegate::ShellDevToolsManagerDelegate( |
| 253 | BrowserContext* browser_context) |
| 254 | : browser_context_(browser_context) { |
| 255 | } |
| 256 | |
| 257 | ShellDevToolsManagerDelegate::~ShellDevToolsManagerDelegate() { |
| 258 | } |
| 259 | |
| 260 | base::DictionaryValue* ShellDevToolsManagerDelegate::HandleCommand( |
| 261 | DevToolsAgentHost* agent_host, |
| 262 | base::DictionaryValue* command) { |
| 263 | return NULL; |
| 264 | } |
| 265 | |
| 266 | std::string ShellDevToolsManagerDelegate::GetPageThumbnailData( |
| 267 | const GURL& url) { |
[email protected] | 007b3f8 | 2013-04-09 08:46:45 | [diff] [blame] | 268 | return std::string(); |
[email protected] | e5ea93b | 2012-09-27 05:50:36 | [diff] [blame] | 269 | } |
| 270 | |
[email protected] | c78ecec21 | 2013-10-27 19:34:10 | [diff] [blame] | 271 | scoped_ptr<DevToolsTarget> |
dgozman | 252e18d | 2014-09-22 12:40:06 | [diff] [blame] | 272 | ShellDevToolsManagerDelegate::CreateNewTarget(const GURL& url) { |
[email protected] | eb04099 | 2012-10-10 16:56:00 | [diff] [blame] | 273 | Shell* shell = Shell::CreateNewWindow(browser_context_, |
[email protected] | c78ecec21 | 2013-10-27 19:34:10 | [diff] [blame] | 274 | url, |
[email protected] | eb04099 | 2012-10-10 16:56:00 | [diff] [blame] | 275 | NULL, |
[email protected] | cdb80672 | 2013-01-10 14:18:23 | [diff] [blame] | 276 | gfx::Size()); |
vkuzkokov | e1133eb | 2014-08-25 13:33:16 | [diff] [blame] | 277 | return scoped_ptr<DevToolsTarget>( |
| 278 | new Target(DevToolsAgentHost::GetOrCreateFor(shell->web_contents()))); |
[email protected] | eb04099 | 2012-10-10 16:56:00 | [diff] [blame] | 279 | } |
| 280 | |
dgozman | 252e18d | 2014-09-22 12:40:06 | [diff] [blame] | 281 | void ShellDevToolsManagerDelegate::EnumerateTargets(TargetCallback callback) { |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 282 | TargetList targets; |
vkuzkokov | cbabd58 | 2014-11-06 13:53:54 | [diff] [blame] | 283 | for (const auto& agent_host : DevToolsAgentHost::GetOrCreateAll()) { |
| 284 | targets.push_back(new Target(agent_host)); |
[email protected] | 852b34ba | 2013-10-03 16:29:06 | [diff] [blame] | 285 | } |
| 286 | callback.Run(targets); |
[email protected] | 2fb8c1d | 2013-03-11 22:00:17 | [diff] [blame] | 287 | } |
| 288 | |
[email protected] | ee75b899 | 2012-01-27 07:53:57 | [diff] [blame] | 289 | } // namespace content |