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 "content/browser/devtools/worker_devtools_manager.h"
10 #include "ipc/ipc_listener.h"
15 class SharedWorkerInstance
;
17 class WorkerDevToolsAgentHost
: public IPCDevToolsAgentHost
,
18 public IPC::Listener
{
20 typedef WorkerDevToolsManager::WorkerId WorkerId
;
22 // DevToolsAgentHost override.
23 bool IsWorker() const override
;
24 BrowserContext
* GetBrowserContext() override
;
26 // IPCDevToolsAgentHost implementation.
27 void SendMessageToAgent(IPC::Message
* message
) override
;
28 void Attach() override
;
29 void OnClientAttached() override
;
30 void OnClientDetached() override
;
32 // IPC::Listener implementation.
33 bool OnMessageReceived(const IPC::Message
& msg
) override
;
35 void WorkerReadyForInspection();
36 void WorkerRestarted(WorkerId worker_id
);
37 void WorkerDestroyed();
41 WorkerDevToolsAgentHost(WorkerId worker_id
);
42 ~WorkerDevToolsAgentHost() override
;
48 WORKER_PAUSED_FOR_DEBUG_ON_START
,
49 WORKER_PAUSED_FOR_REATTACH
,
52 void AttachToWorker();
53 void DetachFromWorker();
55 void OnDispatchOnInspectorFrontend(const DevToolsMessageChunk
& message
);
57 void set_state(WorkerState state
) { state_
= state
; }
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_