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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/public/browser/devtools_agent_host_client.h" | 15 #include "content/public/browser/devtools_agent_host_client.h" |
| 16 #include "url/gurl.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 class DevToolsExternalAgentProxyDelegate; | 20 class DevToolsExternalAgentProxyDelegate; |
20 class WebContents; | 21 class WebContents; |
21 | 22 |
22 // Describes interface for managing devtools agents from browser process. | 23 // Describes interface for managing devtools agents from browser process. |
23 class CONTENT_EXPORT DevToolsAgentHost | 24 class CONTENT_EXPORT DevToolsAgentHost |
24 : public base::RefCounted<DevToolsAgentHost> { | 25 : public base::RefCounted<DevToolsAgentHost> { |
25 public: | 26 public: |
(...skipping 15 matching lines...) Expand all Loading... |
41 int worker_route_id); | 42 int worker_route_id); |
42 | 43 |
43 // Creates DevToolsAgentHost that communicates to the target by means of | 44 // Creates DevToolsAgentHost that communicates to the target by means of |
44 // provided |delegate|. |delegate| ownership is passed to the created agent | 45 // provided |delegate|. |delegate| ownership is passed to the created agent |
45 // host. | 46 // host. |
46 static scoped_refptr<DevToolsAgentHost> Create( | 47 static scoped_refptr<DevToolsAgentHost> Create( |
47 DevToolsExternalAgentProxyDelegate* delegate); | 48 DevToolsExternalAgentProxyDelegate* delegate); |
48 | 49 |
49 static bool IsDebuggerAttached(WebContents* web_contents); | 50 static bool IsDebuggerAttached(WebContents* web_contents); |
50 | 51 |
51 // Returns a list of all existing WebContents that can be debugged. | 52 typedef std::vector<scoped_refptr<DevToolsAgentHost> > List; |
52 static std::vector<WebContents*> GetInspectableWebContents(); | 53 |
| 54 // Returns all possible DevToolsAgentHosts |
| 55 static List GetOrCreateAll(); |
53 | 56 |
54 // Client attaches to this agent host to start debugging it. | 57 // Client attaches to this agent host to start debugging it. |
55 virtual void AttachClient(DevToolsAgentHostClient* client) = 0; | 58 virtual void AttachClient(DevToolsAgentHostClient* client) = 0; |
56 | 59 |
57 // Already attached client detaches from this agent host to stop debugging it. | 60 // Already attached client detaches from this agent host to stop debugging it. |
58 virtual void DetachClient() = 0; | 61 virtual void DetachClient() = 0; |
59 | 62 |
60 // Returns true if there is a client attached. | 63 // Returns true if there is a client attached. |
61 virtual bool IsAttached() = 0; | 64 virtual bool IsAttached() = 0; |
62 | 65 |
(...skipping 12 matching lines...) Expand all Loading... |
75 // Temporarily detaches render view host from this host. Must be followed by | 78 // Temporarily detaches render view host from this host. Must be followed by |
76 // a call to ConnectWebContents (may leak the host instance otherwise). | 79 // a call to ConnectWebContents (may leak the host instance otherwise). |
77 virtual void DisconnectWebContents() = 0; | 80 virtual void DisconnectWebContents() = 0; |
78 | 81 |
79 // Attaches render view host to this host. | 82 // Attaches render view host to this host. |
80 virtual void ConnectWebContents(WebContents* web_contents) = 0; | 83 virtual void ConnectWebContents(WebContents* web_contents) = 0; |
81 | 84 |
82 // Returns true if DevToolsAgentHost is for worker. | 85 // Returns true if DevToolsAgentHost is for worker. |
83 virtual bool IsWorker() const = 0; | 86 virtual bool IsWorker() const = 0; |
84 | 87 |
| 88 // Returns url associated with agent host. |
| 89 virtual GURL GetURL() = 0; |
| 90 |
85 // Terminates all debugging sessions and detaches all clients. | 91 // Terminates all debugging sessions and detaches all clients. |
86 static void DetachAllClients(); | 92 static void DetachAllClients(); |
87 | 93 |
88 typedef base::Callback<void(DevToolsAgentHost*, bool attached)> | 94 typedef base::Callback<void(DevToolsAgentHost*, bool attached)> |
89 AgentStateCallback; | 95 AgentStateCallback; |
90 | 96 |
91 static void AddAgentStateCallback(const AgentStateCallback& callback); | 97 static void AddAgentStateCallback(const AgentStateCallback& callback); |
92 static void RemoveAgentStateCallback(const AgentStateCallback& callback); | 98 static void RemoveAgentStateCallback(const AgentStateCallback& callback); |
93 | 99 |
94 protected: | 100 protected: |
95 friend class base::RefCounted<DevToolsAgentHost>; | 101 friend class base::RefCounted<DevToolsAgentHost>; |
96 virtual ~DevToolsAgentHost() {} | 102 virtual ~DevToolsAgentHost() {} |
97 }; | 103 }; |
98 | 104 |
99 } // namespace content | 105 } // namespace content |
100 | 106 |
101 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ | 107 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ |
OLD | NEW |