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

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

Issue 459403002: DevTools: Added service workers to remote debugging targets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
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/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
14 #include "url/gurl.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 class DevToolsExternalAgentProxyDelegate; 18 class DevToolsExternalAgentProxyDelegate;
18 class WebContents; 19 class WebContents;
19 20
20 // Describes interface for managing devtools agents from browser process. 21 // Describes interface for managing devtools agents from browser process.
21 class CONTENT_EXPORT DevToolsAgentHost 22 class CONTENT_EXPORT DevToolsAgentHost
22 : public base::RefCounted<DevToolsAgentHost> { 23 : public base::RefCounted<DevToolsAgentHost> {
23 public: 24 public:
25 // Return value of GetType for agent host associated with WebContents.
26 static const char kTypeWebContents[];
27
28 // Return value of GetType for agent host associated with shared worker.
29 static const char kTypeWorker[];
30
31 // Return value of GetType for agent host associated with service worker.
32 static const char kTypeServiceWorker[];
jam 2014/08/15 17:35:45 why aren't these an enum?
33
24 // Returns DevToolsAgentHost with a given |id| or NULL of it does not exist. 34 // Returns DevToolsAgentHost with a given |id| or NULL of it does not exist.
25 static scoped_refptr<DevToolsAgentHost> GetForId(const std::string& id); 35 static scoped_refptr<DevToolsAgentHost> GetForId(const std::string& id);
26 36
27 // Returns DevToolsAgentHost that can be used for inspecting |web_contents|. 37 // Returns DevToolsAgentHost that can be used for inspecting |web_contents|.
28 // New DevToolsAgentHost will be created if it does not exist. 38 // New DevToolsAgentHost will be created if it does not exist.
29 static scoped_refptr<DevToolsAgentHost> GetOrCreateFor( 39 static scoped_refptr<DevToolsAgentHost> GetOrCreateFor(
30 WebContents* web_contents); 40 WebContents* web_contents);
31 41
32 // Returns true iff an instance of DevToolsAgentHost for the |web_contents| 42 // Returns true iff an instance of DevToolsAgentHost for the |web_contents|
33 // does exist. 43 // does exist.
34 static bool HasFor(WebContents* web_contents); 44 static bool HasFor(WebContents* web_contents);
35 45
36 // Returns DevToolsAgentHost that can be used for inspecting shared worker 46 // Returns DevToolsAgentHost that can be used for inspecting shared worker
37 // with given worker process host id and routing id. 47 // with given worker process host id and routing id.
38 static scoped_refptr<DevToolsAgentHost> GetForWorker(int worker_process_id, 48 static scoped_refptr<DevToolsAgentHost> GetForWorker(int worker_process_id,
39 int worker_route_id); 49 int worker_route_id);
40 50
41 // Creates DevToolsAgentHost that communicates to the target by means of 51 // Creates DevToolsAgentHost that communicates to the target by means of
42 // provided |delegate|. |delegate| ownership is passed to the created agent 52 // provided |delegate|. |delegate| ownership is passed to the created agent
43 // host. 53 // host.
44 static scoped_refptr<DevToolsAgentHost> Create( 54 static scoped_refptr<DevToolsAgentHost> Create(
45 DevToolsExternalAgentProxyDelegate* delegate); 55 DevToolsExternalAgentProxyDelegate* delegate);
46 56
47 static bool IsDebuggerAttached(WebContents* web_contents); 57 static bool IsDebuggerAttached(WebContents* web_contents);
48 58
49 // Returns a list of all existing WebContents that can be debugged. 59 typedef std::vector<scoped_refptr<DevToolsAgentHost> > List;
50 static std::vector<WebContents*> GetInspectableWebContents(); 60
61 // Returns all possible DevToolsAgentHosts.
62 static List GetOrCreateAll();
51 63
52 // Returns true if there is a client attached. 64 // Returns true if there is a client attached.
53 virtual bool IsAttached() = 0; 65 virtual bool IsAttached() = 0;
54 66
55 // Starts inspecting element at position (|x|, |y|) in the specified page. 67 // Starts inspecting element at position (|x|, |y|) in the specified page.
56 virtual void InspectElement(int x, int y) = 0; 68 virtual void InspectElement(int x, int y) = 0;
57 69
58 // Returns the unique id of the agent. 70 // Returns the unique id of the agent.
59 virtual std::string GetId() = 0; 71 virtual std::string GetId() = 0;
60 72
61 // Returns web contents instance for this host if any. 73 // Returns web contents instance for this host if any.
62 virtual WebContents* GetWebContents() = 0; 74 virtual WebContents* GetWebContents() = 0;
63 75
64 // 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
65 // a call to ConnectWebContents (may leak the host instance otherwise). 77 // a call to ConnectWebContents (may leak the host instance otherwise).
66 virtual void DisconnectWebContents() = 0; 78 virtual void DisconnectWebContents() = 0;
67 79
68 // Attaches render view host to this host. 80 // Attaches render view host to this host.
69 virtual void ConnectWebContents(WebContents* web_contents) = 0; 81 virtual void ConnectWebContents(WebContents* web_contents) = 0;
70 82
71 // Returns true if DevToolsAgentHost is for worker. 83 // Returns true if DevToolsAgentHost is for worker.
72 virtual bool IsWorker() const = 0; 84 virtual bool IsWorker() const = 0;
73 85
86 // Returns agent host type.
87 virtual std::string GetType() = 0;
88
89 // Returns agent host title.
90 virtual std::string GetTitle() = 0;
91
92 // Returns url associated with agent host.
93 virtual GURL GetURL() = 0;
94
95 // Activates agent host. Returns false if the operation failed.
96 virtual bool Activate() = 0;
97
98 // Closes agent host. Returns false if the operation failed.
99 virtual bool Close() = 0;
100
74 protected: 101 protected:
75 friend class base::RefCounted<DevToolsAgentHost>; 102 friend class base::RefCounted<DevToolsAgentHost>;
76 virtual ~DevToolsAgentHost() {} 103 virtual ~DevToolsAgentHost() {}
77 }; 104 };
78 105
79 } // namespace content 106 } // namespace content
80 107
81 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ 108 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/devtools/render_view_devtools_agent_host.cc ('k') | content/shell/browser/shell_devtools_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698