diff options
author | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-01 16:21:44 +0000 |
---|---|---|
committer | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-01 16:21:44 +0000 |
commit | 0e12d7d59d4778e1a8ef692d244bf66aea1a80b8 (patch) | |
tree | 11fd0f2f8d0ab431f59084541922d6c971876f99 /content/public/browser/devtools_manager.h | |
parent | 5581458c8b7ac9e7117d96606d74e574c41df8d6 (diff) | |
download | chromium_src-0e12d7d59d4778e1a8ef692d244bf66aea1a80b8.zip chromium_src-0e12d7d59d4778e1a8ef692d244bf66aea1a80b8.tar.gz chromium_src-0e12d7d59d4778e1a8ef692d244bf66aea1a80b8.tar.bz2 |
Define DevTools content API
The API consists of the following parts:
* DevToolsManager routes messages between devtools agents and clients
* DevToolsAgentHost provides an abstract interface to the debuggee, currently it is either RenderViewHost or Shared Worker. Client can obtain DevToolsAgentHost from DevToolsAgentHostRegistry.
* DevToolsClientHost is an API that should be implemented by DevTools front-end. There is a default Chromium implementation living in chrome/ and a remote debugging server which also implements this interface. Clients can extend it in order to provide custom front-end. There is a default DevTools front-end implementation and content/ provides a way for creating corresponding DevToolsClientHost by means of DevToolsClientHost::CreateDevToolsFrontendHost. The embedder just needs to provide a concrete delegate.
* This patch also removes DevToolsHost_ForwardToAgent and DevToolsHost_ForwardToClient IPC messages which were used to forward only one message. DevTools IPC messages are now hidden behind the devtools content API.
BUG=104625
TEST=Existing tests
Review URL: http://codereview.chromium.org/8549022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112473 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/public/browser/devtools_manager.h')
-rw-r--r-- | content/public/browser/devtools_manager.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/content/public/browser/devtools_manager.h b/content/public/browser/devtools_manager.h new file mode 100644 index 0000000..d2f1667 --- /dev/null +++ b/content/public/browser/devtools_manager.h @@ -0,0 +1,79 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CONTENT_PUBLIC_BROWSER_DEVTOOLS_MANAGER_H_ +#define CONTENT_PUBLIC_BROWSER_DEVTOOLS_MANAGER_H_ +#pragma once + +#include <string> + +#include "content/common/content_export.h" + +class TabContents; + +namespace IPC { +class Message; +} + +namespace content { + +class DevToolsAgentHost; +class DevToolsClientHost; + +// DevToolsManager connects a devtools client to inspected agent and routes +// devtools messages between the inspected instance represented by the agent +// and devtools front-end represented by the client. If inspected agent +// gets terminated DevToolsManager will notify corresponding client and +// remove it from the map. +class CONTENT_EXPORT DevToolsManager { + public: + static DevToolsManager* GetInstance(); + + // Routes devtools message from |from| client to corresponding + // DevToolsAgentHost. + virtual bool DispatchOnInspectorBackend(DevToolsClientHost* from, + const std::string& message) = 0; + + // Invoked when a tab is replaced by another tab. This is triggered by + // TabStripModel::ReplaceTabContentsAt. + virtual void TabReplaced(TabContents* old_tab, TabContents* new_tab) = 0; + + // Closes all open developer tools windows. + virtual void CloseAllClientHosts() = 0; + + // Returns client attached to the |agent_host| if there is one. + virtual DevToolsClientHost* GetDevToolsClientHostFor( + DevToolsAgentHost* agent_host) = 0; + + // Registers new DevToolsClientHost for inspected |agent_host|. There must be + // no other DevToolsClientHosts registered for the |agent_host| at the moment. + virtual void RegisterDevToolsClientHostFor( + DevToolsAgentHost* agent_host, + DevToolsClientHost* client_host) = 0; + // Unregisters given |agent_host|. DevToolsManager will notify corresponding + // client if one is attached. + virtual void UnregisterDevToolsClientHostFor( + DevToolsAgentHost* agent_host) = 0; + + // Detaches client from |from_agent| and returns a cookie that allows to + // reattach that client to another agent later. Returns -1 if there is no + // client attached to |from_agent|. + virtual int DetachClientHost(DevToolsAgentHost* from_agent) = 0; + // Reattaches client host detached with DetachClientHost method above + // to |to_agent|. + virtual void AttachClientHost(int client_host_cookie, + DevToolsAgentHost* to_agent) = 0; + + // This method will remove all references from the manager to the + // DevToolsClientHost and unregister all listeners related to the + // DevToolsClientHost. Called by closing client. + virtual void ClientHostClosing(DevToolsClientHost* client_host) = 0; + + // Starts inspecting element at position (x, y) in the specified page. + virtual void InspectElement(DevToolsAgentHost* agent_host, int x, int y) = 0; +}; + +} // namespace content + +#endif // CONTENT_PUBLIC_BROWSER_DEVTOOLS_MANAGER_H_ |