Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / content / browser / devtools / devtools_agent_host_impl.h
blobac7fff625c24175d1190dc67a381f6ea7d7d0db8
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;
22 // Describes interface for managing devtools agents from the browser process.
23 class CONTENT_EXPORT DevToolsAgentHostImpl : public DevToolsAgentHost {
24 public:
25 // Returns a list of all existing WebContents that can be debugged.
26 static std::vector<WebContents*> GetInspectableWebContents();
28 // Informs the hosted agent that a client host has attached.
29 virtual void Attach() = 0;
31 // Informs the hosted agent that a client host has detached.
32 virtual void Detach() = 0;
34 // Sends a message to the agent.
35 virtual void DispatchProtocolMessage(const std::string& message) = 0;
37 // Opens the inspector for this host.
38 void Inspect(BrowserContext* browser_context);
40 // DevToolsAgentHost implementation.
41 void AttachClient(DevToolsAgentHostClient* client) override;
42 void DetachClient() override;
43 bool IsAttached() override;
44 void InspectElement(int x, int y) override;
45 std::string GetId() override;
46 BrowserContext* GetBrowserContext() override;
47 WebContents* GetWebContents() override;
48 void DisconnectWebContents() override;
49 void ConnectWebContents(WebContents* wc) override;
50 bool IsWorker() const override;
52 protected:
53 DevToolsAgentHostImpl();
54 ~DevToolsAgentHostImpl() override;
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_;
67 } // namespace content
69 #endif // CONTENT_BROWSER_DEVTOOLS_DEVTOOLS_AGENT_HOST_IMPL_H_