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_MANAGER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_IMPL_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_IMPL_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 DevToolsManagerImpl(); | 42 DevToolsManagerImpl(); |
43 virtual ~DevToolsManagerImpl(); | 43 virtual ~DevToolsManagerImpl(); |
44 | 44 |
45 void DispatchOnInspectorFrontend(DevToolsAgentHost* agent_host, | 45 void DispatchOnInspectorFrontend(DevToolsAgentHost* agent_host, |
46 const std::string& message); | 46 const std::string& message); |
47 | 47 |
48 // DevToolsManager implementation | 48 // DevToolsManager implementation |
49 virtual bool DispatchOnInspectorBackend(DevToolsClientHost* from, | 49 virtual bool DispatchOnInspectorBackend(DevToolsClientHost* from, |
50 const std::string& message) OVERRIDE; | 50 const std::string& message) OVERRIDE; |
51 virtual void CloseAllClientHosts() OVERRIDE; | 51 virtual void CloseAllClientHosts() OVERRIDE; |
52 virtual DevToolsClientHost* GetDevToolsClientHostFor( | |
53 DevToolsAgentHost* agent_host) OVERRIDE; | |
54 virtual DevToolsAgentHost* GetDevToolsAgentHostFor( | 52 virtual DevToolsAgentHost* GetDevToolsAgentHostFor( |
55 DevToolsClientHost* client_host) OVERRIDE; | 53 DevToolsClientHost* client_host) OVERRIDE; |
56 virtual void RegisterDevToolsClientHostFor( | 54 virtual void RegisterDevToolsClientHostFor( |
57 DevToolsAgentHost* agent_host, | 55 DevToolsAgentHost* agent_host, |
58 DevToolsClientHost* client_host) OVERRIDE; | 56 DevToolsClientHost* client_host) OVERRIDE; |
59 virtual void UnregisterDevToolsClientHostFor( | |
60 DevToolsAgentHost* agent_host) OVERRIDE; | |
61 virtual void ClientHostClosing(DevToolsClientHost* host) OVERRIDE; | 57 virtual void ClientHostClosing(DevToolsClientHost* host) OVERRIDE; |
62 | 58 |
63 private: | 59 private: |
| 60 friend class DevToolsAgentHostImpl; |
64 friend struct DefaultSingletonTraits<DevToolsManagerImpl>; | 61 friend struct DefaultSingletonTraits<DevToolsManagerImpl>; |
65 | 62 |
66 // DevToolsAgentHost::CloseListener implementation. | 63 // DevToolsAgentHost::CloseListener implementation. |
67 virtual void AgentHostClosing(DevToolsAgentHostImpl* host) OVERRIDE; | 64 virtual void AgentHostClosing(DevToolsAgentHostImpl* host) OVERRIDE; |
68 | 65 |
69 void BindClientHost(DevToolsAgentHostImpl* agent_host, | 66 void BindClientHost(DevToolsAgentHostImpl* agent_host, |
70 DevToolsClientHost* client_host); | 67 DevToolsClientHost* client_host); |
71 void UnbindClientHost(DevToolsAgentHostImpl* agent_host, | 68 void UnbindClientHost(DevToolsAgentHostImpl* agent_host, |
72 DevToolsClientHost* client_host); | 69 DevToolsClientHost* client_host); |
73 | 70 |
| 71 DevToolsClientHost* GetDevToolsClientHostFor( |
| 72 DevToolsAgentHostImpl* agent_host); |
| 73 |
| 74 void UnregisterDevToolsClientHostFor(DevToolsAgentHostImpl* agent_host); |
| 75 |
74 // These two maps are for tracking dependencies between inspected contents and | 76 // These two maps are for tracking dependencies between inspected contents and |
75 // their DevToolsClientHosts. They are useful for routing devtools messages | 77 // their DevToolsClientHosts. They are useful for routing devtools messages |
76 // and allow us to have at most one devtools client host per contents. | 78 // and allow us to have at most one devtools client host per contents. |
77 // | 79 // |
78 // DevToolsManagerImpl starts listening to DevToolsClientHosts when they are | 80 // DevToolsManagerImpl starts listening to DevToolsClientHosts when they are |
79 // put into these maps and removes them when they are closing. | 81 // put into these maps and removes them when they are closing. |
80 typedef std::map<DevToolsAgentHostImpl*, DevToolsClientHost*> | 82 typedef std::map<DevToolsAgentHostImpl*, DevToolsClientHost*> |
81 AgentToClientHostMap; | 83 AgentToClientHostMap; |
82 AgentToClientHostMap agent_to_client_host_; | 84 AgentToClientHostMap agent_to_client_host_; |
83 | 85 |
84 typedef std::map<DevToolsClientHost*, scoped_refptr<DevToolsAgentHostImpl> > | 86 typedef std::map<DevToolsClientHost*, scoped_refptr<DevToolsAgentHostImpl> > |
85 ClientToAgentHostMap; | 87 ClientToAgentHostMap; |
86 ClientToAgentHostMap client_to_agent_host_; | 88 ClientToAgentHostMap client_to_agent_host_; |
87 | 89 |
88 DISALLOW_COPY_AND_ASSIGN(DevToolsManagerImpl); | 90 DISALLOW_COPY_AND_ASSIGN(DevToolsManagerImpl); |
89 }; | 91 }; |
90 | 92 |
91 } // namespace content | 93 } // namespace content |
92 | 94 |
93 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_IMPL_H_ | 95 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_IMPL_H_ |
OLD | NEW |