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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_
6 #define CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_
10 #include "base/compiler_specific.h"
11 #include "content/common/content_export.h"
12 #include "content/public/browser/devtools_agent_host.h"
21 class DevToolsProtocolHandler
;
23 // Describes interface for managing devtools agents from the browser process.
24 class CONTENT_EXPORT DevToolsAgentHostImpl
: public DevToolsAgentHost
{
26 // Informs the hosted agent that a client host has attached.
27 virtual void Attach() = 0;
29 // Informs the hosted agent that a client host has detached.
30 virtual void Detach() = 0;
32 // Sends a message to the agent.
33 bool DispatchProtocolMessage(const std::string
& message
) override
;
35 // Opens the inspector for this host.
36 void Inspect(BrowserContext
* browser_context
);
38 // DevToolsAgentHost implementation.
39 void AttachClient(DevToolsAgentHostClient
* client
) override
;
40 void DetachClient() override
;
41 bool IsAttached() override
;
42 void InspectElement(int x
, int y
) override
;
43 std::string
GetId() override
;
44 BrowserContext
* GetBrowserContext() override
;
45 WebContents
* GetWebContents() override
;
46 void DisconnectWebContents() override
;
47 void ConnectWebContents(WebContents
* wc
) override
;
50 DevToolsAgentHostImpl();
51 ~DevToolsAgentHostImpl() override
;
53 scoped_ptr
<DevToolsProtocolHandler
> protocol_handler_
;
55 void set_handle_all_protocol_commands() { handle_all_commands_
= true; }
57 void SendMessageToClient(const std::string
& message
);
58 static void NotifyCallbacks(DevToolsAgentHostImpl
* agent_host
, bool attached
);
61 friend class DevToolsAgentHost
; // for static methods
63 const std::string id_
;
64 DevToolsAgentHostClient
* client_
;
65 bool handle_all_commands_
;
68 } // namespace content
70 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_