Chromium Code Reviews| 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_forward.h" | |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "url/gurl.h" | |
| 14 | 16 |
| 15 namespace content { | 17 namespace content { |
| 16 | 18 |
| 17 class DevToolsExternalAgentProxyDelegate; | 19 class DevToolsExternalAgentProxyDelegate; |
| 18 class RenderViewHost; | 20 class RenderViewHost; |
| 19 class WebContents; | 21 class WebContents; |
| 20 | 22 |
| 21 // Describes interface for managing devtools agents from browser process. | 23 // Describes interface for managing devtools agents from browser process. |
| 22 class CONTENT_EXPORT DevToolsAgentHost | 24 class CONTENT_EXPORT DevToolsAgentHost |
| 23 : public base::RefCounted<DevToolsAgentHost> { | 25 : public base::RefCounted<DevToolsAgentHost> { |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 36 | 38 |
| 37 // Returns true iff an instance of DevToolsAgentHost for the |rvh| | 39 // Returns true iff an instance of DevToolsAgentHost for the |rvh| |
| 38 // does exist. | 40 // does exist. |
| 39 static bool HasFor(RenderViewHost* rvh); | 41 static bool HasFor(RenderViewHost* rvh); |
| 40 | 42 |
| 41 // Returns DevToolsAgentHost that can be used for inspecting shared worker | 43 // Returns DevToolsAgentHost that can be used for inspecting shared worker |
| 42 // with given worker process host id and routing id. | 44 // with given worker process host id and routing id. |
| 43 static scoped_refptr<DevToolsAgentHost> GetForWorker(int worker_process_id, | 45 static scoped_refptr<DevToolsAgentHost> GetForWorker(int worker_process_id, |
| 44 int worker_route_id); | 46 int worker_route_id); |
| 45 | 47 |
| 48 typedef std::vector<scoped_refptr<DevToolsAgentHost> > List; | |
| 49 typedef base::Callback<void(const List&)> Callback; | |
|
dgozman
2014/07/14 11:17:24
AllHostsCallback
vkuzkokov
2014/07/14 15:31:33
ListCallback
| |
| 50 // Returns all possible DevToolsAgentHosts | |
| 51 static void GetOrCreateAllHosts(const Callback& callback); | |
| 52 | |
| 46 // Creates DevToolsAgentHost that communicates to the target by means of | 53 // Creates DevToolsAgentHost that communicates to the target by means of |
| 47 // provided |delegate|. |delegate| ownership is passed to the created agent | 54 // provided |delegate|. |delegate| ownership is passed to the created agent |
| 48 // host. | 55 // host. |
| 49 static scoped_refptr<DevToolsAgentHost> Create( | 56 static scoped_refptr<DevToolsAgentHost> Create( |
| 50 DevToolsExternalAgentProxyDelegate* delegate); | 57 DevToolsExternalAgentProxyDelegate* delegate); |
| 51 | 58 |
| 52 static bool IsDebuggerAttached(WebContents* web_contents); | 59 static bool IsDebuggerAttached(WebContents* web_contents); |
| 53 | 60 |
| 54 // Returns a list of all existing RenderViewHost's that can be debugged. | 61 // Returns a list of all existing RenderViewHost's that can be debugged. |
| 55 static std::vector<RenderViewHost*> GetValidRenderViewHosts(); | 62 static std::vector<RenderViewHost*> GetValidRenderViewHosts(); |
|
dgozman
2014/07/14 11:17:25
This one should go away.
vkuzkokov
2014/07/14 15:31:33
Done.
| |
| 56 | 63 |
| 57 // Returns true if there is a client attached. | 64 // Returns true if there is a client attached. |
| 58 virtual bool IsAttached() = 0; | 65 virtual bool IsAttached() = 0; |
| 59 | 66 |
| 60 // Starts inspecting element at position (|x|, |y|) in the specified page. | 67 // Starts inspecting element at position (|x|, |y|) in the specified page. |
| 61 virtual void InspectElement(int x, int y) = 0; | 68 virtual void InspectElement(int x, int y) = 0; |
| 62 | 69 |
| 63 // Returns the unique id of the agent. | 70 // Returns the unique id of the agent. |
| 64 virtual std::string GetId() = 0; | 71 virtual std::string GetId() = 0; |
| 65 | 72 |
| 66 // Returns render view host instance for this host if any. | 73 // Returns render view host instance for this host if any. |
| 67 virtual RenderViewHost* GetRenderViewHost() = 0; | 74 virtual RenderViewHost* GetRenderViewHost() = 0; |
| 68 | 75 |
| 69 // Temporarily detaches render view host from this host. Must be followed by | 76 // Temporarily detaches render view host from this host. Must be followed by |
| 70 // a call to ConnectRenderViewHost (may leak the host instance otherwise). | 77 // a call to ConnectRenderViewHost (may leak the host instance otherwise). |
| 71 virtual void DisconnectRenderViewHost() = 0; | 78 virtual void DisconnectRenderViewHost() = 0; |
| 72 | 79 |
| 73 // Attaches render view host to this host. | 80 // Attaches render view host to this host. |
| 74 virtual void ConnectRenderViewHost(RenderViewHost* rvh) = 0; | 81 virtual void ConnectRenderViewHost(RenderViewHost* rvh) = 0; |
| 75 | 82 |
| 76 // Returns true if DevToolsAgentHost is for worker. | 83 // Returns true if DevToolsAgentHost is for worker. |
| 77 virtual bool IsWorker() const = 0; | 84 virtual bool IsWorker() const = 0; |
|
dgozman
2014/07/14 11:17:25
You need to remove this method, and instead add Ge
| |
| 78 | 85 |
| 86 // Returns url associated with agent host. | |
| 87 virtual GURL GetURL() = 0; | |
| 88 | |
| 79 protected: | 89 protected: |
| 80 friend class base::RefCounted<DevToolsAgentHost>; | 90 friend class base::RefCounted<DevToolsAgentHost>; |
| 81 virtual ~DevToolsAgentHost() {} | 91 virtual ~DevToolsAgentHost() {} |
| 82 }; | 92 }; |
| 83 | 93 |
| 84 } // namespace content | 94 } // namespace content |
| 85 | 95 |
| 86 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ | 96 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ |
| OLD | NEW |