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_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "content/public/browser/devtools_agent_host.h" | 12 #include "content/public/browser/devtools_agent_host.h" |
13 | 13 |
14 namespace IPC { | 14 namespace IPC { |
15 class Message; | 15 class Message; |
16 } | 16 } |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
| 20 class BrowserContext; |
| 21 |
20 // Describes interface for managing devtools agents from the browser process. | 22 // Describes interface for managing devtools agents from the browser process. |
21 class CONTENT_EXPORT DevToolsAgentHostImpl : public DevToolsAgentHost { | 23 class CONTENT_EXPORT DevToolsAgentHostImpl : public DevToolsAgentHost { |
22 public: | 24 public: |
23 class CONTENT_EXPORT CloseListener { | |
24 public: | |
25 virtual void AgentHostClosing(DevToolsAgentHostImpl*) = 0; | |
26 protected: | |
27 virtual ~CloseListener() {} | |
28 }; | |
29 | |
30 // Informs the hosted agent that a client host has attached. | 25 // Informs the hosted agent that a client host has attached. |
31 virtual void Attach() = 0; | 26 virtual void Attach() = 0; |
32 | 27 |
33 // Informs the hosted agent that a client host has detached. | 28 // Informs the hosted agent that a client host has detached. |
34 virtual void Detach() = 0; | 29 virtual void Detach() = 0; |
35 | 30 |
36 // Sends a message to the agent hosted by this object. | 31 // Sends a message to the agent. |
37 virtual void DispatchOnInspectorBackend(const std::string& message) = 0; | 32 virtual void DispatchProtocolMessage(const std::string& message) = 0; |
38 | 33 |
39 void set_close_listener(CloseListener* listener) { | 34 // Opens the inspector for this host. |
40 close_listener_ = listener; | 35 void Inspect(BrowserContext* browser_context); |
41 } | |
42 | 36 |
43 // DevToolsAgentHost implementation. | 37 // DevToolsAgentHost implementation. |
| 38 virtual void AttachClient(DevToolsAgentHostClient* client) OVERRIDE; |
| 39 virtual void DetachClient() OVERRIDE; |
44 virtual bool IsAttached() OVERRIDE; | 40 virtual bool IsAttached() OVERRIDE; |
45 | |
46 virtual void InspectElement(int x, int y) OVERRIDE; | 41 virtual void InspectElement(int x, int y) OVERRIDE; |
47 | |
48 virtual std::string GetId() OVERRIDE; | 42 virtual std::string GetId() OVERRIDE; |
49 | |
50 virtual WebContents* GetWebContents() OVERRIDE; | 43 virtual WebContents* GetWebContents() OVERRIDE; |
51 | |
52 virtual void DisconnectWebContents() OVERRIDE; | 44 virtual void DisconnectWebContents() OVERRIDE; |
53 | 45 virtual void ConnectWebContents(WebContents* wc) OVERRIDE; |
54 virtual void ConnectWebContents(WebContents* rvh) OVERRIDE; | |
55 | |
56 virtual bool IsWorker() const OVERRIDE; | 46 virtual bool IsWorker() const OVERRIDE; |
57 | 47 |
58 protected: | 48 protected: |
59 DevToolsAgentHostImpl(); | 49 DevToolsAgentHostImpl(); |
60 virtual ~DevToolsAgentHostImpl(); | 50 virtual ~DevToolsAgentHostImpl(); |
61 | 51 |
62 void NotifyCloseListener(); | 52 void HostClosed(); |
| 53 void SendMessageToClient(const std::string& message); |
| 54 static void NotifyCallbacks(DevToolsAgentHostImpl* agent_host, bool attached); |
63 | 55 |
64 private: | 56 private: |
65 CloseListener* close_listener_; | 57 friend class DevToolsAgentHost; // for static methods |
| 58 |
66 const std::string id_; | 59 const std::string id_; |
| 60 DevToolsAgentHostClient* client_; |
67 }; | 61 }; |
68 | 62 |
69 } // namespace content | 63 } // namespace content |
70 | 64 |
71 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ | 65 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ |
OLD | NEW |