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

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

Issue 2289773002: Revert of DevTools: merge devtools target with devtools host, part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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
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 <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
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 "base/time/time.h"
15 #include "content/common/content_export.h" 14 #include "content/common/content_export.h"
16 #include "content/public/browser/devtools_agent_host_client.h" 15 #include "content/public/browser/devtools_agent_host_client.h"
17 #include "url/gurl.h" 16 #include "url/gurl.h"
18 17
19 namespace base { 18 namespace base {
20 class SingleThreadTaskRunner; 19 class SingleThreadTaskRunner;
21 } 20 }
22 21
23 namespace net { 22 namespace net {
24 class ServerSocket; 23 class ServerSocket;
25 } 24 }
26 25
27 namespace content { 26 namespace content {
28 27
29 class BrowserContext; 28 class BrowserContext;
30 class DevToolsExternalAgentProxyDelegate; 29 class DevToolsExternalAgentProxyDelegate;
31 class RenderFrameHost; 30 class RenderFrameHost;
32 class WebContents; 31 class WebContents;
33 32
34 // Describes interface for managing devtools agents from browser process. 33 // Describes interface for managing devtools agents from browser process.
35 class CONTENT_EXPORT DevToolsAgentHost 34 class CONTENT_EXPORT DevToolsAgentHost
36 : public base::RefCounted<DevToolsAgentHost> { 35 : public base::RefCounted<DevToolsAgentHost> {
37 public: 36 public:
38 static char kTypePage[]; 37 enum Type {
39 static char kTypeFrame[]; 38 // Agent host associated with WebContents.
40 static char kTypeSharedWorker[]; 39 TYPE_WEB_CONTENTS,
41 static char kTypeServiceWorker[]; 40
42 static char kTypeExternal[]; 41 // Agent host associated with RenderFrameHost.
43 static char kTypeBrowser[]; 42 TYPE_FRAME,
44 static char kTypeOther[]; 43
44 // Agent host associated with shared worker.
45 TYPE_SHARED_WORKER,
46
47 // Agent host associated with service worker.
48 TYPE_SERVICE_WORKER,
49
50 // Agent host associated with DevToolsExternalAgentProxyDelegate.
51 TYPE_EXTERNAL,
52
53 // Agent host associated with browser.
54 TYPE_BROWSER,
55 };
45 56
46 // Latest DevTools protocol version supported. 57 // Latest DevTools protocol version supported.
47 static std::string GetProtocolVersion(); 58 static std::string GetProtocolVersion();
48 59
49 // Returns whether particular version of DevTools protocol is supported. 60 // Returns whether particular version of DevTools protocol is supported.
50 static bool IsSupportedProtocolVersion(const std::string& version); 61 static bool IsSupportedProtocolVersion(const std::string& version);
51 62
52 // Returns DevToolsAgentHost with a given |id| or nullptr of it doesn't exist. 63 // Returns DevToolsAgentHost with a given |id| or nullptr of it doesn't exist.
53 static scoped_refptr<DevToolsAgentHost> GetForId(const std::string& id); 64 static scoped_refptr<DevToolsAgentHost> GetForId(const std::string& id);
54 65
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 const std::string& message) = 0; 129 const std::string& message) = 0;
119 130
120 // Starts inspecting element at position (|x|, |y|). 131 // Starts inspecting element at position (|x|, |y|).
121 virtual void InspectElement(DevToolsAgentHostClient* client, 132 virtual void InspectElement(DevToolsAgentHostClient* client,
122 int x, 133 int x,
123 int y) = 0; 134 int y) = 0;
124 135
125 // Returns the unique id of the agent. 136 // Returns the unique id of the agent.
126 virtual std::string GetId() = 0; 137 virtual std::string GetId() = 0;
127 138
128 // Returns the id of the parent host, or empty string if no parent.
129 virtual std::string GetParentId() = 0;
130
131 // Returns web contents instance for this host if any. 139 // Returns web contents instance for this host if any.
132 virtual WebContents* GetWebContents() = 0; 140 virtual WebContents* GetWebContents() = 0;
133 141
134 // Returns related browser context instance if available. 142 // Returns related browser context instance if available.
135 virtual BrowserContext* GetBrowserContext() = 0; 143 virtual BrowserContext* GetBrowserContext() = 0;
136 144
137 // Temporarily detaches WebContents from this host. Must be followed by 145 // Temporarily detaches WebContents from this host. Must be followed by
138 // a call to ConnectWebContents (may leak the host instance otherwise). 146 // a call to ConnectWebContents (may leak the host instance otherwise).
139 virtual void DisconnectWebContents() = 0; 147 virtual void DisconnectWebContents() = 0;
140 148
141 // Attaches render view host to this host. 149 // Attaches render view host to this host.
142 virtual void ConnectWebContents(WebContents* web_contents) = 0; 150 virtual void ConnectWebContents(WebContents* web_contents) = 0;
143 151
144 // Returns agent host type. 152 // Returns agent host type.
145 virtual std::string GetType() = 0; 153 virtual Type GetType() = 0;
146 154
147 // Returns agent host title. 155 // Returns agent host title.
148 virtual std::string GetTitle() = 0; 156 virtual std::string GetTitle() = 0;
149 157
150 // Returns the host description.
151 virtual std::string GetDescription() = 0;
152
153 // Override host description.
154 virtual void SetDescriptionOverride(const std::string& description) = 0;
155
156 // Returns url associated with agent host. 158 // Returns url associated with agent host.
157 virtual GURL GetURL() = 0; 159 virtual GURL GetURL() = 0;
158 160
159 // Returns the favicon url for this host.
160 virtual GURL GetFaviconURL() = 0;
161
162 // Activates agent host. Returns false if the operation failed. 161 // Activates agent host. Returns false if the operation failed.
163 virtual bool Activate() = 0; 162 virtual bool Activate() = 0;
164 163
165 // Opens devtools for this agent host. Returns false if the operation failed.
166 virtual bool Inspect() = 0;
167
168 // Reloads the host.
169 virtual void Reload() = 0;
170
171 // Closes agent host. Returns false if the operation failed. 164 // Closes agent host. Returns false if the operation failed.
172 virtual bool Close() = 0; 165 virtual bool Close() = 0;
173 166
174 // Returns the time when the host was last active.
175 virtual base::TimeTicks GetLastActivityTime() = 0;
176
177 // Terminates all debugging sessions and detaches all clients. 167 // Terminates all debugging sessions and detaches all clients.
178 static void DetachAllClients(); 168 static void DetachAllClients();
179 169
180 typedef base::Callback<void(DevToolsAgentHost*, bool attached)> 170 typedef base::Callback<void(DevToolsAgentHost*, bool attached)>
181 AgentStateCallback; 171 AgentStateCallback;
182 172
183 static void AddAgentStateCallback(const AgentStateCallback& callback); 173 static void AddAgentStateCallback(const AgentStateCallback& callback);
184 static void RemoveAgentStateCallback(const AgentStateCallback& callback); 174 static void RemoveAgentStateCallback(const AgentStateCallback& callback);
185 175
186 protected: 176 protected:
187 friend class base::RefCounted<DevToolsAgentHost>; 177 friend class base::RefCounted<DevToolsAgentHost>;
188 virtual ~DevToolsAgentHost() {} 178 virtual ~DevToolsAgentHost() {}
189 }; 179 };
190 180
191 } // namespace content 181 } // namespace content
192 182
193 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ 183 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698