| 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 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "content/browser/devtools/devtools_agent_host_impl.h" | 14 #include "content/browser/devtools/devtools_agent_host_impl.h" |
| 15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
| 16 #include "content/public/browser/devtools_client_host.h" | 16 #include "content/public/browser/devtools_client_host.h" |
| 17 #include "content/public/browser/devtools_manager.h" | 17 #include "content/public/browser/devtools_manager.h" |
| 18 | 18 |
| 19 class GURL; | 19 class GURL; |
| 20 | 20 |
| 21 namespace IPC { | 21 namespace IPC { |
| 22 class Message; | 22 class Message; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 | 26 |
| 27 class BrowserContext; |
| 28 class DevToolsManagerDelegate; |
| 27 class RenderViewHost; | 29 class RenderViewHost; |
| 28 | 30 |
| 29 // This class is a singleton that manages DevToolsClientHost instances and | 31 // This class is a singleton that manages DevToolsClientHost instances and |
| 30 // routes messages between developer tools clients and agents. | 32 // routes messages between developer tools clients and agents. |
| 31 // | 33 // |
| 32 // Methods below that accept inspected RenderViewHost as a parameter are | 34 // Methods below that accept inspected RenderViewHost as a parameter are |
| 33 // just convenience methods that call corresponding methods accepting | 35 // just convenience methods that call corresponding methods accepting |
| 34 // DevToolAgentHost. | 36 // DevToolAgentHost. |
| 35 class CONTENT_EXPORT DevToolsManagerImpl | 37 class CONTENT_EXPORT DevToolsManagerImpl |
| 36 : public DevToolsAgentHostImpl::CloseListener, | 38 : public DevToolsAgentHostImpl::CloseListener, |
| 37 public DevToolsManager { | 39 public DevToolsManager { |
| 38 public: | 40 public: |
| 39 // Returns single instance of this class. The instance is destroyed on the | 41 // Returns single instance of this class. The instance is destroyed on the |
| 40 // browser main loop exit so this method MUST NOT be called after that point. | 42 // browser main loop exit so this method MUST NOT be called after that point. |
| 41 static DevToolsManagerImpl* GetInstance(); | 43 static DevToolsManagerImpl* GetInstance(); |
| 42 | 44 |
| 43 DevToolsManagerImpl(); | 45 DevToolsManagerImpl(); |
| 44 virtual ~DevToolsManagerImpl(); | 46 virtual ~DevToolsManagerImpl(); |
| 45 | 47 |
| 48 // Opens the inspector for |agent_host|. |
| 49 void Inspect(BrowserContext* browser_context, DevToolsAgentHost* agent_host); |
| 50 |
| 46 void DispatchOnInspectorFrontend(DevToolsAgentHost* agent_host, | 51 void DispatchOnInspectorFrontend(DevToolsAgentHost* agent_host, |
| 47 const std::string& message); | 52 const std::string& message); |
| 48 | 53 |
| 49 // DevToolsManager implementation | 54 // DevToolsManager implementation |
| 50 virtual bool DispatchOnInspectorBackend(DevToolsClientHost* from, | 55 virtual bool DispatchOnInspectorBackend(DevToolsClientHost* from, |
| 51 const std::string& message) OVERRIDE; | 56 const std::string& message) OVERRIDE; |
| 52 virtual void CloseAllClientHosts() OVERRIDE; | 57 virtual void CloseAllClientHosts() OVERRIDE; |
| 53 virtual DevToolsAgentHost* GetDevToolsAgentHostFor( | 58 virtual DevToolsAgentHost* GetDevToolsAgentHostFor( |
| 54 DevToolsClientHost* client_host) OVERRIDE; | 59 DevToolsClientHost* client_host) OVERRIDE; |
| 55 virtual void RegisterDevToolsClientHostFor( | 60 virtual void RegisterDevToolsClientHostFor( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 AgentToClientHostMap; | 94 AgentToClientHostMap; |
| 90 AgentToClientHostMap agent_to_client_host_; | 95 AgentToClientHostMap agent_to_client_host_; |
| 91 | 96 |
| 92 typedef std::map<DevToolsClientHost*, scoped_refptr<DevToolsAgentHostImpl> > | 97 typedef std::map<DevToolsClientHost*, scoped_refptr<DevToolsAgentHostImpl> > |
| 93 ClientToAgentHostMap; | 98 ClientToAgentHostMap; |
| 94 ClientToAgentHostMap client_to_agent_host_; | 99 ClientToAgentHostMap client_to_agent_host_; |
| 95 | 100 |
| 96 typedef std::vector<const Callback*> CallbackContainer; | 101 typedef std::vector<const Callback*> CallbackContainer; |
| 97 CallbackContainer callbacks_; | 102 CallbackContainer callbacks_; |
| 98 | 103 |
| 104 scoped_ptr<DevToolsManagerDelegate> delegate_; |
| 105 |
| 99 DISALLOW_COPY_AND_ASSIGN(DevToolsManagerImpl); | 106 DISALLOW_COPY_AND_ASSIGN(DevToolsManagerImpl); |
| 100 }; | 107 }; |
| 101 | 108 |
| 102 } // namespace content | 109 } // namespace content |
| 103 | 110 |
| 104 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_IMPL_H_ | 111 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_IMPL_H_ |
| OLD | NEW |