Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / content / browser / devtools / devtools_agent_host_impl.h
blob698bfe90a16d4f489d49e6914a693bc6927daf85
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_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "content/common/content_export.h"
12 #include "content/public/browser/devtools_agent_host.h"
14 namespace IPC {
15 class Message;
18 namespace content {
20 class BrowserContext;
21 class DevToolsProtocolHandler;
23 // Describes interface for managing devtools agents from the browser process.
24 class CONTENT_EXPORT DevToolsAgentHostImpl : public DevToolsAgentHost {
25 public:
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;
49 protected:
50 DevToolsAgentHostImpl();
51 ~DevToolsAgentHostImpl() override;
53 scoped_ptr<DevToolsProtocolHandler> protocol_handler_;
55 void set_handle_all_protocol_commands() { handle_all_commands_ = true; }
56 void HostClosed();
57 void SendMessageToClient(const std::string& message);
58 static void NotifyCallbacks(DevToolsAgentHostImpl* agent_host, bool attached);
60 private:
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_