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

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

Issue 467653002: Revert of [DevTools] Make DevTools clients talk directly to DevToolsAgentHost instead of using DevToolsManage… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/browser/devtools_agent_host_client.h » ('j') | 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 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/callback.h"
13 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
14 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
15 #include "content/public/browser/devtools_agent_host_client.h"
16 14
17 namespace content { 15 namespace content {
18 16
19 class DevToolsExternalAgentProxyDelegate; 17 class DevToolsExternalAgentProxyDelegate;
20 class WebContents; 18 class WebContents;
21 19
22 // Describes interface for managing devtools agents from browser process. 20 // Describes interface for managing devtools agents from browser process.
23 class CONTENT_EXPORT DevToolsAgentHost 21 class CONTENT_EXPORT DevToolsAgentHost
24 : public base::RefCounted<DevToolsAgentHost> { 22 : public base::RefCounted<DevToolsAgentHost> {
25 public: 23 public:
(...skipping 18 matching lines...) Expand all
44 // provided |delegate|. |delegate| ownership is passed to the created agent 42 // provided |delegate|. |delegate| ownership is passed to the created agent
45 // host. 43 // host.
46 static scoped_refptr<DevToolsAgentHost> Create( 44 static scoped_refptr<DevToolsAgentHost> Create(
47 DevToolsExternalAgentProxyDelegate* delegate); 45 DevToolsExternalAgentProxyDelegate* delegate);
48 46
49 static bool IsDebuggerAttached(WebContents* web_contents); 47 static bool IsDebuggerAttached(WebContents* web_contents);
50 48
51 // Returns a list of all existing WebContents that can be debugged. 49 // Returns a list of all existing WebContents that can be debugged.
52 static std::vector<WebContents*> GetInspectableWebContents(); 50 static std::vector<WebContents*> GetInspectableWebContents();
53 51
54 // Client attaches to this agent host to start debugging it.
55 virtual void AttachClient(DevToolsAgentHostClient* client) = 0;
56
57 // Already attached client detaches from this agent host to stop debugging it.
58 virtual void DetachClient() = 0;
59
60 // Returns true if there is a client attached. 52 // Returns true if there is a client attached.
61 virtual bool IsAttached() = 0; 53 virtual bool IsAttached() = 0;
62 54
63 // Sends a message to the agent.
64 virtual void DispatchProtocolMessage(const std::string& message) = 0;
65
66 // Starts inspecting element at position (|x|, |y|) in the specified page. 55 // Starts inspecting element at position (|x|, |y|) in the specified page.
67 virtual void InspectElement(int x, int y) = 0; 56 virtual void InspectElement(int x, int y) = 0;
68 57
69 // Returns the unique id of the agent. 58 // Returns the unique id of the agent.
70 virtual std::string GetId() = 0; 59 virtual std::string GetId() = 0;
71 60
72 // Returns web contents instance for this host if any. 61 // Returns web contents instance for this host if any.
73 virtual WebContents* GetWebContents() = 0; 62 virtual WebContents* GetWebContents() = 0;
74 63
75 // Temporarily detaches render view host from this host. Must be followed by 64 // Temporarily detaches render view host from this host. Must be followed by
76 // a call to ConnectWebContents (may leak the host instance otherwise). 65 // a call to ConnectWebContents (may leak the host instance otherwise).
77 virtual void DisconnectWebContents() = 0; 66 virtual void DisconnectWebContents() = 0;
78 67
79 // Attaches render view host to this host. 68 // Attaches render view host to this host.
80 virtual void ConnectWebContents(WebContents* web_contents) = 0; 69 virtual void ConnectWebContents(WebContents* web_contents) = 0;
81 70
82 // Returns true if DevToolsAgentHost is for worker. 71 // Returns true if DevToolsAgentHost is for worker.
83 virtual bool IsWorker() const = 0; 72 virtual bool IsWorker() const = 0;
84 73
85 // Terminates all debugging sessions and detaches all clients.
86 static void DetachAllClients();
87
88 typedef base::Callback<void(DevToolsAgentHost*, bool attached)>
89 AgentStateCallback;
90
91 static void AddAgentStateCallback(const AgentStateCallback& callback);
92 static void RemoveAgentStateCallback(const AgentStateCallback& callback);
93
94 protected: 74 protected:
95 friend class base::RefCounted<DevToolsAgentHost>; 75 friend class base::RefCounted<DevToolsAgentHost>;
96 virtual ~DevToolsAgentHost() {} 76 virtual ~DevToolsAgentHost() {}
97 }; 77 };
98 78
99 } // namespace content 79 } // namespace content
100 80
101 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ 81 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_
OLDNEW
« no previous file with comments | « content/content_browser.gypi ('k') | content/public/browser/devtools_agent_host_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698