Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1038)

Side by Side Diff: content/public/browser/devtools_agent_host.h

Issue 12319114: Extract debugger target enumeration into a separate class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@debugger
Patch Set: Rebase Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/devtools/render_view_devtools_agent_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
12 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 class RenderViewHost; 17 class RenderViewHost;
17 class WebContents; 18 class WebContents;
18 19
19 // Describes interface for managing devtools agents from browser process. 20 // Describes interface for managing devtools agents from browser process.
20 class CONTENT_EXPORT DevToolsAgentHost 21 class CONTENT_EXPORT DevToolsAgentHost
21 : public base::RefCounted<DevToolsAgentHost> { 22 : public base::RefCounted<DevToolsAgentHost> {
22 public: 23 public:
23 // Returns DevToolsAgentHost that can be used for inspecting |rvh|. 24 // Returns DevToolsAgentHost that can be used for inspecting |rvh|.
24 // New DevToolsAgentHost will be created if it does not exist. 25 // New DevToolsAgentHost will be created if it does not exist.
25 static scoped_refptr<DevToolsAgentHost> GetFor(RenderViewHost* rvh); 26 static scoped_refptr<DevToolsAgentHost> GetFor(RenderViewHost* rvh);
26 27
27 // Returns true iff an instance of DevToolsAgentHost for the |rvh| 28 // Returns true iff an instance of DevToolsAgentHost for the |rvh|
28 // does exist. 29 // does exist.
29 static bool HasFor(RenderViewHost* rvh); 30 static bool HasFor(RenderViewHost* rvh);
30 31
31 // Returns DevToolsAgentHost that can be used for inspecting shared worker 32 // Returns DevToolsAgentHost that can be used for inspecting shared worker
32 // with given worker process host id and routing id. 33 // with given worker process host id and routing id.
33 static scoped_refptr<DevToolsAgentHost> GetForWorker(int worker_process_id, 34 static scoped_refptr<DevToolsAgentHost> GetForWorker(int worker_process_id,
34 int worker_route_id); 35 int worker_route_id);
35 36
36 static bool IsDebuggerAttached(WebContents* web_contents); 37 static bool IsDebuggerAttached(WebContents* web_contents);
37 38
38 // Detaches given |rvh| from the agent host temporarily and returns a cookie 39 // Detaches given |rvh| from the agent host temporarily and returns the agent
39 // that allows to reattach another rvh to that agen thost later. Returns -1 if 40 // host id that allows to reattach another rvh to that agent host later.
40 // there is no agent host associated with the |rvh|. 41 // Returns empty string if there is no agent host associated with the |rvh|.
41 static int DisconnectRenderViewHost(RenderViewHost* rvh); 42 static std::string DisconnectRenderViewHost(RenderViewHost* rvh);
42 43
43 // Reattaches agent host detached with DisconnectRenderViewHost method above 44 // Reattaches agent host detached with DisconnectRenderViewHost method above
44 // to |rvh|. 45 // to |rvh|.
45 static void ConnectRenderViewHost(int agent_host_cookie, 46 static void ConnectRenderViewHost(const std::string& agent_host_cookie,
46 RenderViewHost* rvh); 47 RenderViewHost* rvh);
47 48
49 // Returns a list of all existing RenderViewHost's that can be debugged.
50 static std::vector<RenderViewHost*> GetValidRenderViewHosts();
51
52 // Returns the unique id of the agent.
53 virtual std::string GetId() = 0;
54
48 // Returns render view host instance for this host if any. 55 // Returns render view host instance for this host if any.
49 virtual RenderViewHost* GetRenderViewHost() = 0; 56 virtual RenderViewHost* GetRenderViewHost() = 0;
50 57
51 protected: 58 protected:
52 friend class base::RefCounted<DevToolsAgentHost>; 59 friend class base::RefCounted<DevToolsAgentHost>;
53 virtual ~DevToolsAgentHost() {} 60 virtual ~DevToolsAgentHost() {}
54 }; 61 };
55 62
56 } // namespace content 63 } // namespace content
57 64
58 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ 65 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/devtools/render_view_devtools_agent_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698