Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace net { | 23 namespace net { |
| 24 class ServerSocket; | 24 class ServerSocket; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 class BrowserContext; | 29 class BrowserContext; |
| 30 class DevToolsExternalAgentProxyDelegate; | 30 class DevToolsExternalAgentProxyDelegate; |
| 31 class DevToolsManagerDelegate; | |
| 31 class RenderFrameHost; | 32 class RenderFrameHost; |
| 32 class WebContents; | 33 class WebContents; |
| 33 | 34 |
| 34 // Describes interface for managing devtools agents from browser process. | 35 // Describes interface for managing devtools agents from browser process. |
| 35 class CONTENT_EXPORT DevToolsAgentHost | 36 class CONTENT_EXPORT DevToolsAgentHost |
| 36 : public base::RefCounted<DevToolsAgentHost> { | 37 : public base::RefCounted<DevToolsAgentHost> { |
| 37 public: | 38 public: |
| 38 static char kTypePage[]; | 39 static char kTypePage[]; |
| 39 static char kTypeFrame[]; | 40 static char kTypeFrame[]; |
| 40 static char kTypeSharedWorker[]; | 41 static char kTypeSharedWorker[]; |
| 41 static char kTypeServiceWorker[]; | 42 static char kTypeServiceWorker[]; |
| 42 static char kTypeExternal[]; | 43 static char kTypeExternal[]; |
| 43 static char kTypeBrowser[]; | 44 static char kTypeBrowser[]; |
| 44 static char kTypeOther[]; | 45 static char kTypeOther[]; |
| 45 | 46 |
| 47 // This is temporary while we are merging http handler and discovery | |
| 48 // into content/. | |
| 49 static DevToolsManagerDelegate* GetDevToolsManagerDelegate(); | |
| 50 | |
| 46 // Latest DevTools protocol version supported. | 51 // Latest DevTools protocol version supported. |
| 47 static std::string GetProtocolVersion(); | 52 static std::string GetProtocolVersion(); |
| 48 | 53 |
| 49 // Returns whether particular version of DevTools protocol is supported. | 54 // Returns whether particular version of DevTools protocol is supported. |
| 50 static bool IsSupportedProtocolVersion(const std::string& version); | 55 static bool IsSupportedProtocolVersion(const std::string& version); |
| 51 | 56 |
| 52 // Returns DevToolsAgentHost with a given |id| or nullptr of it doesn't exist. | 57 // Returns DevToolsAgentHost with a given |id| or nullptr of it doesn't exist. |
| 53 static scoped_refptr<DevToolsAgentHost> GetForId(const std::string& id); | 58 static scoped_refptr<DevToolsAgentHost> GetForId(const std::string& id); |
| 54 | 59 |
| 55 // Returns DevToolsAgentHost that can be used for inspecting |web_contents|. | 60 // Returns DevToolsAgentHost that can be used for inspecting |web_contents|. |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 85 base::Callback<std::unique_ptr<net::ServerSocket>(std::string*)>; | 90 base::Callback<std::unique_ptr<net::ServerSocket>(std::string*)>; |
| 86 | 91 |
| 87 // Creates DevToolsAgentHost for the browser, which works with browser-wide | 92 // Creates DevToolsAgentHost for the browser, which works with browser-wide |
| 88 // debugging protocol. | 93 // debugging protocol. |
| 89 static scoped_refptr<DevToolsAgentHost> CreateForBrowser( | 94 static scoped_refptr<DevToolsAgentHost> CreateForBrowser( |
| 90 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, | 95 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, |
| 91 const CreateServerSocketCallback& socket_callback); | 96 const CreateServerSocketCallback& socket_callback); |
| 92 | 97 |
| 93 static bool IsDebuggerAttached(WebContents* web_contents); | 98 static bool IsDebuggerAttached(WebContents* web_contents); |
| 94 | 99 |
| 95 typedef std::vector<scoped_refptr<DevToolsAgentHost> > List; | 100 using List = std::vector<scoped_refptr<DevToolsAgentHost>>; |
| 96 | 101 |
| 97 // Returns all possible DevToolsAgentHosts. | 102 using DiscoveryCallback = base::Callback<List()>; |
| 103 | |
| 104 static void AddDiscoveryProvider(const DiscoveryCallback& callback); | |
|
dgozman
2016/08/25 01:08:11
Add a comment to this one.
| |
| 105 | |
| 106 // Returns all DevToolsAgentHosts content is aware of. | |
| 98 static List GetOrCreateAll(); | 107 static List GetOrCreateAll(); |
| 99 | 108 |
| 109 // Returns all possible DevToolsAgentHosts embedder is aware of. | |
| 110 static List DiscoverAllHosts(); | |
| 111 | |
| 100 // Attaches |client| to this agent host to start debugging. | 112 // Attaches |client| to this agent host to start debugging. |
| 101 // Returns true iff attach succeeded. | 113 // Returns true iff attach succeeded. |
| 102 virtual bool AttachClient(DevToolsAgentHostClient* client) = 0; | 114 virtual bool AttachClient(DevToolsAgentHostClient* client) = 0; |
| 103 | 115 |
| 104 // Attaches |client| to this agent host to start debugging. Disconnects | 116 // Attaches |client| to this agent host to start debugging. Disconnects |
| 105 // any existing clients. | 117 // any existing clients. |
| 106 virtual void ForceAttachClient(DevToolsAgentHostClient* client) = 0; | 118 virtual void ForceAttachClient(DevToolsAgentHostClient* client) = 0; |
| 107 | 119 |
| 108 // Already attached client detaches from this agent host to stop debugging it. | 120 // Already attached client detaches from this agent host to stop debugging it. |
| 109 // Returns true iff detach succeeded. | 121 // Returns true iff detach succeeded. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 184 static void RemoveAgentStateCallback(const AgentStateCallback& callback); | 196 static void RemoveAgentStateCallback(const AgentStateCallback& callback); |
| 185 | 197 |
| 186 protected: | 198 protected: |
| 187 friend class base::RefCounted<DevToolsAgentHost>; | 199 friend class base::RefCounted<DevToolsAgentHost>; |
| 188 virtual ~DevToolsAgentHost() {} | 200 virtual ~DevToolsAgentHost() {} |
| 189 }; | 201 }; |
| 190 | 202 |
| 191 } // namespace content | 203 } // namespace content |
| 192 | 204 |
| 193 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ | 205 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ |
| OLD | NEW |