OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_MANAGER_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_DEVTOOLS_MANAGER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "content/common/content_export.h" |
| 12 |
| 13 class TabContents; |
| 14 |
| 15 namespace IPC { |
| 16 class Message; |
| 17 } |
| 18 |
| 19 namespace content { |
| 20 |
| 21 class DevToolsAgentHost; |
| 22 class DevToolsClientHost; |
| 23 |
| 24 // DevToolsManager connects a devtools client to inspected agent and routes |
| 25 // devtools messages between the inspected instance represented by the agent |
| 26 // and devtools front-end represented by the client. If inspected agent |
| 27 // gets terminated DevToolsManager will notify corresponding client and |
| 28 // remove it from the map. |
| 29 class CONTENT_EXPORT DevToolsManager { |
| 30 public: |
| 31 static DevToolsManager* GetInstance(); |
| 32 |
| 33 // Routes devtools message from |from| client to corresponding |
| 34 // DevToolsAgentHost. |
| 35 virtual bool DispatchOnInspectorBackend(DevToolsClientHost* from, |
| 36 const std::string& message) = 0; |
| 37 |
| 38 // Invoked when a tab is replaced by another tab. This is triggered by |
| 39 // TabStripModel::ReplaceTabContentsAt. |
| 40 virtual void TabReplaced(TabContents* old_tab, TabContents* new_tab) = 0; |
| 41 |
| 42 // Closes all open developer tools windows. |
| 43 virtual void CloseAllClientHosts() = 0; |
| 44 |
| 45 // Returns client attached to the |agent_host| if there is one. |
| 46 virtual DevToolsClientHost* GetDevToolsClientHostFor( |
| 47 DevToolsAgentHost* agent_host) = 0; |
| 48 |
| 49 // Registers new DevToolsClientHost for inspected |agent_host|. There must be |
| 50 // no other DevToolsClientHosts registered for the |agent_host| at the moment. |
| 51 virtual void RegisterDevToolsClientHostFor( |
| 52 DevToolsAgentHost* agent_host, |
| 53 DevToolsClientHost* client_host) = 0; |
| 54 // Unregisters given |agent_host|. DevToolsManager will notify corresponding |
| 55 // client if one is attached. |
| 56 virtual void UnregisterDevToolsClientHostFor( |
| 57 DevToolsAgentHost* agent_host) = 0; |
| 58 |
| 59 // Detaches client from |from_agent| and returns a cookie that allows to |
| 60 // reattach that client to another agent later. Returns -1 if there is no |
| 61 // client attached to |from_agent|. |
| 62 virtual int DetachClientHost(DevToolsAgentHost* from_agent) = 0; |
| 63 // Reattaches client host detached with DetachClientHost method above |
| 64 // to |to_agent|. |
| 65 virtual void AttachClientHost(int client_host_cookie, |
| 66 DevToolsAgentHost* to_agent) = 0; |
| 67 |
| 68 // This method will remove all references from the manager to the |
| 69 // DevToolsClientHost and unregister all listeners related to the |
| 70 // DevToolsClientHost. Called by closing client. |
| 71 virtual void ClientHostClosing(DevToolsClientHost* client_host) = 0; |
| 72 |
| 73 // Starts inspecting element at position (x, y) in the specified page. |
| 74 virtual void InspectElement(DevToolsAgentHost* agent_host, int x, int y) = 0; |
| 75 }; |
| 76 |
| 77 } // namespace content |
| 78 |
| 79 #endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_MANAGER_H_ |
OLD | NEW |