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; | 20 class BrowserContext; |
21 class DevToolsProtocolHandler; | |
21 | 22 |
22 // Describes interface for managing devtools agents from the browser process. | 23 // Describes interface for managing devtools agents from the browser process. |
23 class CONTENT_EXPORT DevToolsAgentHostImpl : public DevToolsAgentHost { | 24 class CONTENT_EXPORT DevToolsAgentHostImpl : public DevToolsAgentHost { |
24 public: | 25 public: |
25 // Informs the hosted agent that a client host has attached. | 26 // Informs the hosted agent that a client host has attached. |
26 virtual void Attach() = 0; | 27 virtual void Attach() = 0; |
27 | 28 |
28 // Informs the hosted agent that a client host has detached. | 29 // Informs the hosted agent that a client host has detached. |
29 virtual void Detach() = 0; | 30 virtual void Detach() = 0; |
30 | 31 |
31 // Sends a message to the agent. | 32 // Sends a message to the agent. |
32 void DispatchProtocolMessage(const std::string& message) override = 0; | 33 bool DispatchProtocolMessage(const std::string& message) override; |
33 | 34 |
34 // Opens the inspector for this host. | 35 // Opens the inspector for this host. |
35 void Inspect(BrowserContext* browser_context); | 36 void Inspect(BrowserContext* browser_context); |
36 | 37 |
37 // DevToolsAgentHost implementation. | 38 // DevToolsAgentHost implementation. |
38 void AttachClient(DevToolsAgentHostClient* client) override; | 39 void AttachClient(DevToolsAgentHostClient* client) override; |
39 void DetachClient() override; | 40 void DetachClient() override; |
40 bool IsAttached() override; | 41 bool IsAttached() override; |
41 void InspectElement(int x, int y) override; | 42 void InspectElement(int x, int y) override; |
42 std::string GetId() override; | 43 std::string GetId() override; |
43 BrowserContext* GetBrowserContext() override; | 44 BrowserContext* GetBrowserContext() override; |
44 WebContents* GetWebContents() override; | 45 WebContents* GetWebContents() override; |
45 void DisconnectWebContents() override; | 46 void DisconnectWebContents() override; |
46 void ConnectWebContents(WebContents* wc) override; | 47 void ConnectWebContents(WebContents* wc) override; |
47 bool IsWorker() const override; | 48 bool IsWorker() const override; |
48 | 49 |
49 protected: | 50 protected: |
50 DevToolsAgentHostImpl(); | 51 DevToolsAgentHostImpl(); |
51 ~DevToolsAgentHostImpl() override; | 52 ~DevToolsAgentHostImpl() override; |
52 | 53 |
54 scoped_ptr<DevToolsProtocolHandler> protocol_handler_; | |
55 | |
53 void HostClosed(); | 56 void HostClosed(); |
54 void SendMessageToClient(const std::string& message); | 57 void SendMessageToClient(const std::string& message); |
55 static void NotifyCallbacks(DevToolsAgentHostImpl* agent_host, bool attached); | 58 static void NotifyCallbacks(DevToolsAgentHostImpl* agent_host, bool attached); |
56 | 59 |
57 private: | 60 private: |
58 friend class DevToolsAgentHost; // for static methods | 61 friend class DevToolsAgentHost; // for static methods |
59 | 62 |
63 void DispatchOnInspectorFrontend(const std::string& message); | |
pfeldman
2015/03/23 09:59:00
This is essentially the same as the SendMessageToC
Kunihiko Sakamoto
2015/03/23 10:23:58
Merged.
| |
64 | |
60 const std::string id_; | 65 const std::string id_; |
61 DevToolsAgentHostClient* client_; | 66 DevToolsAgentHostClient* client_; |
62 }; | 67 }; |
63 | 68 |
64 } // namespace content | 69 } // namespace content |
65 | 70 |
66 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ | 71 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_ |
OLD | NEW |