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 // Registers embedder's custom host providers that are available via |
| 105 // DiscoverAllHosts. |
| 106 static void AddDiscoveryProvider(const DiscoveryCallback& callback); |
| 107 |
| 108 // Returns all DevToolsAgentHosts content is aware of. |
98 static List GetOrCreateAll(); | 109 static List GetOrCreateAll(); |
99 | 110 |
| 111 // Returns all possible DevToolsAgentHosts embedder is aware of. |
| 112 static List DiscoverAllHosts(); |
| 113 |
100 // Attaches |client| to this agent host to start debugging. | 114 // Attaches |client| to this agent host to start debugging. |
101 // Returns true iff attach succeeded. | 115 // Returns true iff attach succeeded. |
102 virtual bool AttachClient(DevToolsAgentHostClient* client) = 0; | 116 virtual bool AttachClient(DevToolsAgentHostClient* client) = 0; |
103 | 117 |
104 // Attaches |client| to this agent host to start debugging. Disconnects | 118 // Attaches |client| to this agent host to start debugging. Disconnects |
105 // any existing clients. | 119 // any existing clients. |
106 virtual void ForceAttachClient(DevToolsAgentHostClient* client) = 0; | 120 virtual void ForceAttachClient(DevToolsAgentHostClient* client) = 0; |
107 | 121 |
108 // Already attached client detaches from this agent host to stop debugging it. | 122 // Already attached client detaches from this agent host to stop debugging it. |
109 // Returns true iff detach succeeded. | 123 // 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); | 198 static void RemoveAgentStateCallback(const AgentStateCallback& callback); |
185 | 199 |
186 protected: | 200 protected: |
187 friend class base::RefCounted<DevToolsAgentHost>; | 201 friend class base::RefCounted<DevToolsAgentHost>; |
188 virtual ~DevToolsAgentHost() {} | 202 virtual ~DevToolsAgentHost() {} |
189 }; | 203 }; |
190 | 204 |
191 } // namespace content | 205 } // namespace content |
192 | 206 |
193 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ | 207 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ |
OLD | NEW |