Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / content / browser / devtools / worker_devtools_agent_host.h
blob30fee5a6211a5dd231afbea18c25baa50faa66a1
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"
11 namespace content {
13 class BrowserContext;
14 class SharedWorkerInstance;
16 class WorkerDevToolsAgentHost : public IPCDevToolsAgentHost,
17 public IPC::Listener {
18 public:
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();
39 bool IsTerminated();
41 protected:
42 WorkerDevToolsAgentHost(WorkerId worker_id);
43 ~WorkerDevToolsAgentHost() override;
45 enum WorkerState {
46 WORKER_UNINSPECTED,
47 WORKER_INSPECTED,
48 WORKER_TERMINATED,
49 WORKER_PAUSED_FOR_DEBUG_ON_START,
50 WORKER_PAUSED_FOR_REATTACH,
53 void AttachToWorker();
54 void DetachFromWorker();
55 void WorkerCreated();
56 void OnDispatchOnInspectorFrontend(const DevToolsMessageChunk& message);
58 const WorkerId& worker_id() const { return worker_id_; }
60 private:
61 friend class SharedWorkerDevToolsManagerTest;
63 WorkerState state_;
64 WorkerId worker_id_;
65 DISALLOW_COPY_AND_ASSIGN(WorkerDevToolsAgentHost);
68 } // namespace content
70 #endif // CONTENT_BROWSER_DEVTOOLS_WORKER_DEVTOOLS_AGENT_HOST_H_