Chromium Code Reviews| 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 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "googleurl/src/gurl.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 |
| 39 static const std::string EmptyCookie; | |
|
pfeldman
2013/03/04 11:43:01
NullId
Vladislav Kaznacheev
2013/03/04 14:30:03
Done.
| |
| 40 | |
| 38 // Detaches given |rvh| from the agent host temporarily and returns a cookie | 41 // Detaches given |rvh| from the agent host temporarily and returns a cookie |
| 39 // that allows to reattach another rvh to that agen thost later. Returns -1 if | 42 // that allows to reattach another rvh to that agen thost later. |
|
pfeldman
2013/03/04 11:43:01
You sould explicitly claim that this is devtools_a
Vladislav Kaznacheev
2013/03/04 14:30:03
Done.
| |
| 40 // there is no agent host associated with the |rvh|. | 43 // ReturnsEmptyCookie if there is no agent host associated with the |rvh|. |
| 41 static int DisconnectRenderViewHost(RenderViewHost* rvh); | 44 static std::string DisconnectRenderViewHost(RenderViewHost* rvh); |
| 42 | 45 |
| 43 // Reattaches agent host detached with DisconnectRenderViewHost method above | 46 // Reattaches agent host detached with DisconnectRenderViewHost method above |
| 44 // to |rvh|. | 47 // to |rvh|. |
| 45 static void ConnectRenderViewHost(int agent_host_cookie, | 48 static void ConnectRenderViewHost(const std::string& agent_host_cookie, |
| 46 RenderViewHost* rvh); | 49 RenderViewHost* rvh); |
| 47 | 50 |
| 51 // Returns the unique id of the agent. | |
| 52 virtual std::string id() = 0; | |
| 53 | |
| 54 // Returns the page title. | |
| 55 virtual std::string title() = 0; | |
| 56 | |
| 57 // Returns the page url. | |
| 58 virtual GURL url() = 0; | |
| 59 | |
| 60 // Returns thumbnail url for the page. | |
| 61 virtual GURL thumbnail_url() = 0; | |
| 62 | |
| 63 // Returns favicon url for the page. | |
| 64 virtual GURL favicon_url() = 0; | |
| 65 | |
| 48 // Returns render view host instance for this host if any. | 66 // Returns render view host instance for this host if any. |
| 49 virtual RenderViewHost* GetRenderViewHost() = 0; | 67 virtual RenderViewHost* GetRenderViewHost() = 0; |
| 50 | 68 |
| 51 protected: | 69 protected: |
| 52 friend class base::RefCounted<DevToolsAgentHost>; | 70 friend class base::RefCounted<DevToolsAgentHost>; |
| 53 virtual ~DevToolsAgentHost() {} | 71 virtual ~DevToolsAgentHost() {} |
| 54 }; | 72 }; |
| 55 | 73 |
| 56 } // namespace content | 74 } // namespace content |
| 57 | 75 |
| 58 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ | 76 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_AGENT_HOST_H_ |
| OLD | NEW |