| 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/files/file_path.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/public/browser/devtools_agent_host_client.h" | 17 #include "content/public/browser/devtools_agent_host_client.h" |
| 18 #include "content/public/browser/devtools_agent_host_observer.h" |
| 18 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 class SingleThreadTaskRunner; | 22 class SingleThreadTaskRunner; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace net { | 25 namespace net { |
| 25 class ServerSocket; | 26 class ServerSocket; |
| 26 } | 27 } |
| 27 | 28 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 std::unique_ptr<DevToolsSocketFactory> server_socket_factory, | 118 std::unique_ptr<DevToolsSocketFactory> server_socket_factory, |
| 118 const std::string& frontend_url, | 119 const std::string& frontend_url, |
| 119 const base::FilePath& active_port_output_directory, | 120 const base::FilePath& active_port_output_directory, |
| 120 const base::FilePath& debug_frontend_dir, | 121 const base::FilePath& debug_frontend_dir, |
| 121 const std::string& product_name, | 122 const std::string& product_name, |
| 122 const std::string& user_agent); | 123 const std::string& user_agent); |
| 123 | 124 |
| 124 // Stops remote debugging. | 125 // Stops remote debugging. |
| 125 static void StopRemoteDebuggingServer(); | 126 static void StopRemoteDebuggingServer(); |
| 126 | 127 |
| 128 // Observer is notified about changes in DevToolsAgentHosts. |
| 129 static void AddObserver(DevToolsAgentHostObserver*); |
| 130 static void RemoveObserver(DevToolsAgentHostObserver*); |
| 131 |
| 127 // Attaches |client| to this agent host to start debugging. | 132 // Attaches |client| to this agent host to start debugging. |
| 128 // Returns true iff attach succeeded. | 133 // Returns true iff attach succeeded. |
| 129 virtual bool AttachClient(DevToolsAgentHostClient* client) = 0; | 134 virtual bool AttachClient(DevToolsAgentHostClient* client) = 0; |
| 130 | 135 |
| 131 // Attaches |client| to this agent host to start debugging. Disconnects | 136 // Attaches |client| to this agent host to start debugging. Disconnects |
| 132 // any existing clients. | 137 // any existing clients. |
| 133 virtual void ForceAttachClient(DevToolsAgentHostClient* client) = 0; | 138 virtual void ForceAttachClient(DevToolsAgentHostClient* client) = 0; |
| 134 | 139 |
| 135 // Already attached client detaches from this agent host to stop debugging it. | 140 // Already attached client detaches from this agent host to stop debugging it. |
| 136 // Returns true iff detach succeeded. | 141 // Returns true iff detach succeeded. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 199 |
| 195 // Closes agent host. Returns false if the operation failed. | 200 // Closes agent host. Returns false if the operation failed. |
| 196 virtual bool Close() = 0; | 201 virtual bool Close() = 0; |
| 197 | 202 |
| 198 // Returns the time when the host was last active. | 203 // Returns the time when the host was last active. |
| 199 virtual base::TimeTicks GetLastActivityTime() = 0; | 204 virtual base::TimeTicks GetLastActivityTime() = 0; |
| 200 | 205 |
| 201 // Terminates all debugging sessions and detaches all clients. | 206 // Terminates all debugging sessions and detaches all clients. |
| 202 static void DetachAllClients(); | 207 static void DetachAllClients(); |
| 203 | 208 |
| 204 typedef base::Callback<void(DevToolsAgentHost*, bool attached)> | |
| 205 AgentStateCallback; | |
| 206 | |
| 207 static void AddAgentStateCallback(const AgentStateCallback& callback); | |
| 208 static void RemoveAgentStateCallback(const AgentStateCallback& callback); | |
| 209 | |
| 210 protected: | 209 protected: |
| 211 friend class base::RefCounted<DevToolsAgentHost>; | 210 friend class base::RefCounted<DevToolsAgentHost>; |
| 212 virtual ~DevToolsAgentHost() {} | 211 virtual ~DevToolsAgentHost() {} |
| 213 }; | 212 }; |
| 214 | 213 |
| 215 } // namespace content | 214 } // namespace content |
| 216 | 215 |
| 217 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ | 216 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ |
| OLD | NEW |