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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, | 101 scoped_refptr<base::SingleThreadTaskRunner> tethering_task_runner, |
102 const CreateServerSocketCallback& socket_callback); | 102 const CreateServerSocketCallback& socket_callback); |
103 | 103 |
104 static bool IsDebuggerAttached(WebContents* web_contents); | 104 static bool IsDebuggerAttached(WebContents* web_contents); |
105 | 105 |
106 typedef std::vector<scoped_refptr<DevToolsAgentHost> > List; | 106 typedef std::vector<scoped_refptr<DevToolsAgentHost> > List; |
107 | 107 |
108 // Returns all possible DevToolsAgentHosts. | 108 // Returns all possible DevToolsAgentHosts. |
109 static List GetOrCreateAll(); | 109 static List GetOrCreateAll(); |
110 | 110 |
111 // Client attaches to this agent host to start debugging it. | 111 // Attaches |client| to this agent host to start debugging. |
112 virtual void AttachClient(DevToolsAgentHostClient* client) = 0; | 112 // Returns true iff attach succeeded. |
| 113 virtual bool AttachClient(DevToolsAgentHostClient* client) = 0; |
| 114 |
| 115 // Attaches |client| to this agent host to start debugging. Disconnects |
| 116 // any existing clients. |
| 117 virtual void ForceAttachClient(DevToolsAgentHostClient* client) = 0; |
113 | 118 |
114 // Already attached client detaches from this agent host to stop debugging it. | 119 // Already attached client detaches from this agent host to stop debugging it. |
115 virtual void DetachClient() = 0; | 120 // Returns true iff detach succeeded. |
| 121 virtual bool DetachClient(DevToolsAgentHostClient* client) = 0; |
116 | 122 |
117 // Returns true if there is a client attached. | 123 // Returns true if there is a client attached. |
118 virtual bool IsAttached() = 0; | 124 virtual bool IsAttached() = 0; |
119 | 125 |
120 // Sends a message to the agent. Returns true if the message is handled. | 126 // Sends |message| from |client| to the agent. |
121 virtual bool DispatchProtocolMessage(const std::string& message) = 0; | 127 // Returns true if the message is dispatched and handled. |
| 128 virtual bool DispatchProtocolMessage(DevToolsAgentHostClient* client, |
| 129 const std::string& message) = 0; |
122 | 130 |
123 // Starts inspecting element at position (|x|, |y|) in the specified page. | 131 // Starts inspecting element at position (|x|, |y|) in the specified page. |
124 virtual void InspectElement(int x, int y) = 0; | 132 virtual void InspectElement(int x, int y) = 0; |
125 | 133 |
126 // Returns the unique id of the agent. | 134 // Returns the unique id of the agent. |
127 virtual std::string GetId() = 0; | 135 virtual std::string GetId() = 0; |
128 | 136 |
129 // Returns web contents instance for this host if any. | 137 // Returns web contents instance for this host if any. |
130 virtual WebContents* GetWebContents() = 0; | 138 virtual WebContents* GetWebContents() = 0; |
131 | 139 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 static void RemoveAgentStateCallback(const AgentStateCallback& callback); | 172 static void RemoveAgentStateCallback(const AgentStateCallback& callback); |
165 | 173 |
166 protected: | 174 protected: |
167 friend class base::RefCounted<DevToolsAgentHost>; | 175 friend class base::RefCounted<DevToolsAgentHost>; |
168 virtual ~DevToolsAgentHost() {} | 176 virtual ~DevToolsAgentHost() {} |
169 }; | 177 }; |
170 | 178 |
171 } // namespace content | 179 } // namespace content |
172 | 180 |
173 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ | 181 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ |
OLD | NEW |