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 |
(...skipping 12 matching lines...) Expand all Loading... | |
23 : public base::RefCounted<DevToolsAgentHost> { | 23 : public base::RefCounted<DevToolsAgentHost> { |
24 public: | 24 public: |
25 // Returns DevToolsAgentHost with a given |id| or NULL of it does not exist. | 25 // Returns DevToolsAgentHost with a given |id| or NULL of it does not exist. |
26 static scoped_refptr<DevToolsAgentHost> GetForId(const std::string& id); | 26 static scoped_refptr<DevToolsAgentHost> GetForId(const std::string& id); |
27 | 27 |
28 // Returns DevToolsAgentHost that can be used for inspecting |web_contents|. | 28 // Returns DevToolsAgentHost that can be used for inspecting |web_contents|. |
29 // New DevToolsAgentHost will be created if it does not exist. | 29 // New DevToolsAgentHost will be created if it does not exist. |
30 static scoped_refptr<DevToolsAgentHost> GetOrCreateFor( | 30 static scoped_refptr<DevToolsAgentHost> GetOrCreateFor( |
31 WebContents* web_contents); | 31 WebContents* web_contents); |
32 | 32 |
33 // Returns DevToolsAgentHost that can be used for inspecting |rvh|. | 33 // Returns true iff an instance of DevToolsAgentHost for the |web_contents| |
34 // New DevToolsAgentHost will be created if it does not exist. | |
35 static scoped_refptr<DevToolsAgentHost> GetOrCreateFor(RenderViewHost* rvh); | |
36 | |
37 // Returns true iff an instance of DevToolsAgentHost for the |rvh| | |
38 // does exist. | 34 // does exist. |
39 static bool HasFor(RenderViewHost* rvh); | 35 static bool HasFor(WebContents* web_contents); |
40 | 36 |
41 // Returns DevToolsAgentHost that can be used for inspecting shared worker | 37 // Returns DevToolsAgentHost that can be used for inspecting shared worker |
42 // with given worker process host id and routing id. | 38 // with given worker process host id and routing id. |
43 static scoped_refptr<DevToolsAgentHost> GetForWorker(int worker_process_id, | 39 static scoped_refptr<DevToolsAgentHost> GetForWorker(int worker_process_id, |
44 int worker_route_id); | 40 int worker_route_id); |
45 | 41 |
46 // Creates DevToolsAgentHost that communicates to the target by means of | 42 // Creates DevToolsAgentHost that communicates to the target by means of |
47 // provided |delegate|. |delegate| ownership is passed to the created agent | 43 // provided |delegate|. |delegate| ownership is passed to the created agent |
48 // host. | 44 // host. |
49 static scoped_refptr<DevToolsAgentHost> Create( | 45 static scoped_refptr<DevToolsAgentHost> Create( |
50 DevToolsExternalAgentProxyDelegate* delegate); | 46 DevToolsExternalAgentProxyDelegate* delegate); |
51 | 47 |
52 static bool IsDebuggerAttached(WebContents* web_contents); | 48 static bool IsDebuggerAttached(WebContents* web_contents); |
53 | 49 |
54 // Returns a list of all existing RenderViewHost's that can be debugged. | 50 // Returns a list of all existing RenderViewHost's that can be debugged. |
55 static std::vector<RenderViewHost*> GetValidRenderViewHosts(); | 51 static std::vector<RenderViewHost*> GetValidRenderViewHosts(); |
dgozman
2014/08/06 13:06:09
This should migrate to WebContents too.
pfeldman
2014/08/06 16:26:35
Done.
| |
56 | 52 |
57 // Returns true if there is a client attached. | 53 // Returns true if there is a client attached. |
58 virtual bool IsAttached() = 0; | 54 virtual bool IsAttached() = 0; |
59 | 55 |
60 // Starts inspecting element at position (|x|, |y|) in the specified page. | 56 // Starts inspecting element at position (|x|, |y|) in the specified page. |
61 virtual void InspectElement(int x, int y) = 0; | 57 virtual void InspectElement(int x, int y) = 0; |
62 | 58 |
63 // Returns the unique id of the agent. | 59 // Returns the unique id of the agent. |
64 virtual std::string GetId() = 0; | 60 virtual std::string GetId() = 0; |
65 | 61 |
66 // Returns render view host instance for this host if any. | 62 // Returns render view host instance for this host if any. |
67 virtual RenderViewHost* GetRenderViewHost() = 0; | 63 virtual RenderViewHost* GetRenderViewHost() = 0; |
dgozman
2014/08/06 13:06:09
This should migrate to WebContents too.
pfeldman
2014/08/06 16:26:35
Done.
| |
68 | 64 |
69 // Temporarily detaches render view host from this host. Must be followed by | 65 // Temporarily detaches render view host from this host. Must be followed by |
70 // a call to ConnectRenderViewHost (may leak the host instance otherwise). | 66 // a call to ConnectRenderViewHost (may leak the host instance otherwise). |
71 virtual void DisconnectRenderViewHost() = 0; | 67 virtual void DisconnectRenderViewHost() = 0; |
72 | 68 |
73 // Attaches render view host to this host. | 69 // Attaches render view host to this host. |
74 virtual void ConnectRenderViewHost(RenderViewHost* rvh) = 0; | 70 virtual void ConnectRenderViewHost(RenderViewHost* rvh) = 0; |
75 | 71 |
76 // Returns true if DevToolsAgentHost is for worker. | 72 // Returns true if DevToolsAgentHost is for worker. |
77 virtual bool IsWorker() const = 0; | 73 virtual bool IsWorker() const = 0; |
78 | 74 |
79 protected: | 75 protected: |
80 friend class base::RefCounted<DevToolsAgentHost>; | 76 friend class base::RefCounted<DevToolsAgentHost>; |
81 virtual ~DevToolsAgentHost() {} | 77 virtual ~DevToolsAgentHost() {} |
82 }; | 78 }; |
83 | 79 |
84 } // namespace content | 80 } // namespace content |
85 | 81 |
86 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ | 82 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ |
OLD | NEW |