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

Side by Side Diff: content/browser/devtools/devtools_manager_impl.h

Issue 13305002: Remove redundant DevToolsManager methods and clean up its clients. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
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_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 24 matching lines...) Expand all
35 : public DevToolsAgentHostImpl::CloseListener, 35 : public DevToolsAgentHostImpl::CloseListener,
36 public DevToolsManager { 36 public DevToolsManager {
37 public: 37 public:
38 // Returns single instance of this class. The instance is destroyed on the 38 // Returns single instance of this class. The instance is destroyed on the
39 // browser main loop exit so this method MUST NOT be called after that point. 39 // browser main loop exit so this method MUST NOT be called after that point.
40 static DevToolsManagerImpl* GetInstance(); 40 static DevToolsManagerImpl* GetInstance();
41 41
42 DevToolsManagerImpl(); 42 DevToolsManagerImpl();
43 virtual ~DevToolsManagerImpl(); 43 virtual ~DevToolsManagerImpl();
44 44
45 void DispatchOnInspectorFrontend(DevToolsAgentHost* agent_host,
46 const std::string& message);
47
48 // DevToolsManager implementation 45 // DevToolsManager implementation
49 virtual bool DispatchOnInspectorBackend(DevToolsClientHost* from, 46 virtual bool DispatchOnInspectorBackend(DevToolsClientHost* from,
50 const std::string& message) OVERRIDE; 47 const std::string& message) OVERRIDE;
48 virtual void DispatchOnInspectorFrontend(DevToolsAgentHost* agent_host,
49 const std::string& message) OVERRIDE;
50
51 virtual void CloseAllClientHosts() OVERRIDE; 51 virtual void CloseAllClientHosts() OVERRIDE;
52 virtual DevToolsClientHost* GetDevToolsClientHostFor( 52 virtual bool IsAttached(DevToolsAgentHost* agent_host) OVERRIDE;
53 DevToolsAgentHost* agent_host) OVERRIDE;
54 virtual DevToolsAgentHost* GetDevToolsAgentHostFor( 53 virtual DevToolsAgentHost* GetDevToolsAgentHostFor(
55 DevToolsClientHost* client_host) OVERRIDE; 54 DevToolsClientHost* client_host) OVERRIDE;
56 virtual void RegisterDevToolsClientHostFor( 55 virtual void RegisterDevToolsClientHostFor(
57 DevToolsAgentHost* agent_host, 56 DevToolsAgentHost* agent_host,
58 DevToolsClientHost* client_host) OVERRIDE; 57 DevToolsClientHost* client_host) OVERRIDE;
59 virtual void UnregisterDevToolsClientHostFor(
60 DevToolsAgentHost* agent_host) OVERRIDE;
61 virtual void ClientHostClosing(DevToolsClientHost* host) OVERRIDE; 58 virtual void ClientHostClosing(DevToolsClientHost* host) OVERRIDE;
62 59
63 private: 60 private:
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
72 DevToolsClientHost* GetDevToolsClientHostFor(
73 DevToolsAgentHostImpl* agent_host);
74
75 void UnregisterDevToolsClientHostFor(DevToolsAgentHostImpl* agent_host);
76
74 // These two maps are for tracking dependencies between inspected contents and 77 // These two maps are for tracking dependencies between inspected contents and
75 // their DevToolsClientHosts. They are useful for routing devtools messages 78 // their DevToolsClientHosts. They are useful for routing devtools messages
76 // and allow us to have at most one devtools client host per contents. 79 // and allow us to have at most one devtools client host per contents.
77 // 80 //
78 // DevToolsManagerImpl starts listening to DevToolsClientHosts when they are 81 // DevToolsManagerImpl starts listening to DevToolsClientHosts when they are
79 // put into these maps and removes them when they are closing. 82 // put into these maps and removes them when they are closing.
80 typedef std::map<DevToolsAgentHostImpl*, DevToolsClientHost*> 83 typedef std::map<DevToolsAgentHostImpl*, DevToolsClientHost*>
81 AgentToClientHostMap; 84 AgentToClientHostMap;
82 AgentToClientHostMap agent_to_client_host_; 85 AgentToClientHostMap agent_to_client_host_;
83 86
84 typedef std::map<DevToolsClientHost*, scoped_refptr<DevToolsAgentHostImpl> > 87 typedef std::map<DevToolsClientHost*, scoped_refptr<DevToolsAgentHostImpl> >
85 ClientToAgentHostMap; 88 ClientToAgentHostMap;
86 ClientToAgentHostMap client_to_agent_host_; 89 ClientToAgentHostMap client_to_agent_host_;
87 90
88 DISALLOW_COPY_AND_ASSIGN(DevToolsManagerImpl); 91 DISALLOW_COPY_AND_ASSIGN(DevToolsManagerImpl);
89 }; 92 };
90 93
91 } // namespace content 94 } // namespace content
92 95
93 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_IMPL_H_ 96 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698