1 // Copyright 2014 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_WORKER_DEVTOOLS_AGENT_HOST_H_
6 #define CONTENT_BROWSER_DEVTOOLS_WORKER_DEVTOOLS_AGENT_HOST_H_
8 #include "content/browser/devtools/ipc_devtools_agent_host.h"
9 #include "ipc/ipc_listener.h"
14 class SharedWorkerInstance
;
16 class WorkerDevToolsAgentHost
: public IPCDevToolsAgentHost
,
17 public IPC::Listener
{
19 typedef std::pair
<int, int> WorkerId
;
21 // DevToolsAgentHost override.
22 BrowserContext
* GetBrowserContext() override
;
24 // IPCDevToolsAgentHost implementation.
25 void SendMessageToAgent(IPC::Message
* message
) override
;
26 void Attach() override
;
27 void OnClientAttached(bool reattached
) override
;
28 void OnClientDetached() override
;
30 // IPC::Listener implementation.
31 bool OnMessageReceived(const IPC::Message
& msg
) override
;
33 void PauseForDebugOnStart();
34 bool IsPausedForDebugOnStart();
36 void WorkerReadyForInspection();
37 void WorkerRestarted(WorkerId worker_id
);
38 void WorkerDestroyed();
42 WorkerDevToolsAgentHost(WorkerId worker_id
);
43 ~WorkerDevToolsAgentHost() override
;
49 WORKER_PAUSED_FOR_DEBUG_ON_START
,
50 WORKER_PAUSED_FOR_REATTACH
,
53 void AttachToWorker();
54 void DetachFromWorker();
56 void OnDispatchOnInspectorFrontend(const DevToolsMessageChunk
& message
);
58 const WorkerId
& worker_id() const { return worker_id_
; }
61 friend class SharedWorkerDevToolsManagerTest
;
65 DISALLOW_COPY_AND_ASSIGN(WorkerDevToolsAgentHost
);
68 } // namespace content
70 #endif // CONTENT_BROWSER_DEVTOOLS_WORKER_DEVTOOLS_AGENT_HOST_H_