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