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> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/files/file_path.h" | |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
16 #include "content/public/browser/devtools_agent_host_client.h" | 17 #include "content/public/browser/devtools_agent_host_client.h" |
17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
18 | 19 |
19 namespace base { | 20 namespace base { |
20 class SingleThreadTaskRunner; | 21 class SingleThreadTaskRunner; |
21 } | 22 } |
22 | 23 |
23 namespace net { | 24 namespace net { |
24 class ServerSocket; | 25 class ServerSocket; |
25 } | 26 } |
26 | 27 |
27 namespace content { | 28 namespace content { |
28 | 29 |
29 class BrowserContext; | 30 class BrowserContext; |
30 class DevToolsExternalAgentProxyDelegate; | 31 class DevToolsExternalAgentProxyDelegate; |
31 class DevToolsManagerDelegate; | 32 class DevToolsManagerDelegate; |
33 class DevToolsSocketFactory; | |
32 class RenderFrameHost; | 34 class RenderFrameHost; |
33 class WebContents; | 35 class WebContents; |
34 | 36 |
35 // Describes interface for managing devtools agents from browser process. | 37 // Describes interface for managing devtools agents from browser process. |
36 class CONTENT_EXPORT DevToolsAgentHost | 38 class CONTENT_EXPORT DevToolsAgentHost |
37 : public base::RefCounted<DevToolsAgentHost> { | 39 : public base::RefCounted<DevToolsAgentHost> { |
38 public: | 40 public: |
39 static char kTypePage[]; | 41 static char kTypePage[]; |
40 static char kTypeFrame[]; | 42 static char kTypeFrame[]; |
41 static char kTypeSharedWorker[]; | 43 static char kTypeSharedWorker[]; |
42 static char kTypeServiceWorker[]; | 44 static char kTypeServiceWorker[]; |
43 static char kTypeExternal[]; | 45 static char kTypeExternal[]; |
44 static char kTypeBrowser[]; | 46 static char kTypeBrowser[]; |
45 static char kTypeOther[]; | 47 static char kTypeOther[]; |
46 | 48 |
47 // This is temporary while we are merging http handler and discovery | 49 // This is temporary while we are merging http handler and discovery |
48 // into content/. | 50 // into content/. |
49 static DevToolsManagerDelegate* GetDevToolsManagerDelegate(); | 51 static DevToolsManagerDelegate* GetDevToolsManagerDelegate(); |
dgozman
2016/09/02 19:33:07
Remove this one.
| |
50 | 52 |
51 // Latest DevTools protocol version supported. | 53 // Latest DevTools protocol version supported. |
52 static std::string GetProtocolVersion(); | 54 static std::string GetProtocolVersion(); |
53 | 55 |
54 // Returns whether particular version of DevTools protocol is supported. | 56 // Returns whether particular version of DevTools protocol is supported. |
55 static bool IsSupportedProtocolVersion(const std::string& version); | 57 static bool IsSupportedProtocolVersion(const std::string& version); |
56 | 58 |
57 // Returns DevToolsAgentHost with a given |id| or nullptr of it doesn't exist. | 59 // Returns DevToolsAgentHost with a given |id| or nullptr of it doesn't exist. |
58 static scoped_refptr<DevToolsAgentHost> GetForId(const std::string& id); | 60 static scoped_refptr<DevToolsAgentHost> GetForId(const std::string& id); |
59 | 61 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 // Registers embedder's custom host providers that are available via | 106 // Registers embedder's custom host providers that are available via |
105 // DiscoverAllHosts. | 107 // DiscoverAllHosts. |
106 static void AddDiscoveryProvider(const DiscoveryCallback& callback); | 108 static void AddDiscoveryProvider(const DiscoveryCallback& callback); |
107 | 109 |
108 // Returns all DevToolsAgentHosts content is aware of. | 110 // Returns all DevToolsAgentHosts content is aware of. |
109 static List GetOrCreateAll(); | 111 static List GetOrCreateAll(); |
110 | 112 |
111 // Returns all possible DevToolsAgentHosts embedder is aware of. | 113 // Returns all possible DevToolsAgentHosts embedder is aware of. |
112 static List DiscoverAllHosts(); | 114 static List DiscoverAllHosts(); |
113 | 115 |
116 // Starts remote debugging. | |
117 // Takes ownership over |socket_factory|. | |
118 // If |frontend_url| is empty, assumes it's bundled. | |
119 // If |active_port_output_directory| is non-empty, it is assumed the | |
120 // socket_factory was initialized with an ephemeral port (0). The | |
121 // port selected by the OS will be written to a well-known file in | |
122 // the output directory. | |
123 static void StartRemoteDebuggingServer( | |
124 std::unique_ptr<DevToolsSocketFactory> server_socket_factory, | |
125 const std::string& frontend_url, | |
126 const base::FilePath& active_port_output_directory, | |
127 const base::FilePath& debug_frontend_dir, | |
128 const std::string& product_name, | |
129 const std::string& user_agent); | |
130 | |
131 // Stops remote debugging. | |
132 static void StopRemoteDebuggingServer(); | |
133 | |
114 // Attaches |client| to this agent host to start debugging. | 134 // Attaches |client| to this agent host to start debugging. |
115 // Returns true iff attach succeeded. | 135 // Returns true iff attach succeeded. |
116 virtual bool AttachClient(DevToolsAgentHostClient* client) = 0; | 136 virtual bool AttachClient(DevToolsAgentHostClient* client) = 0; |
117 | 137 |
118 // Attaches |client| to this agent host to start debugging. Disconnects | 138 // Attaches |client| to this agent host to start debugging. Disconnects |
119 // any existing clients. | 139 // any existing clients. |
120 virtual void ForceAttachClient(DevToolsAgentHostClient* client) = 0; | 140 virtual void ForceAttachClient(DevToolsAgentHostClient* client) = 0; |
121 | 141 |
122 // Already attached client detaches from this agent host to stop debugging it. | 142 // Already attached client detaches from this agent host to stop debugging it. |
123 // Returns true iff detach succeeded. | 143 // Returns true iff detach succeeded. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
198 static void RemoveAgentStateCallback(const AgentStateCallback& callback); | 218 static void RemoveAgentStateCallback(const AgentStateCallback& callback); |
199 | 219 |
200 protected: | 220 protected: |
201 friend class base::RefCounted<DevToolsAgentHost>; | 221 friend class base::RefCounted<DevToolsAgentHost>; |
202 virtual ~DevToolsAgentHost() {} | 222 virtual ~DevToolsAgentHost() {} |
203 }; | 223 }; |
204 | 224 |
205 } // namespace content | 225 } // namespace content |
206 | 226 |
207 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ | 227 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ |
OLD | NEW |