Add ICU message format support
[chromium-blink-merge.git] / content / browser / devtools / worker_devtools_agent_host.h
blobdb91c2756e5136dd1792d1ba78d345a5c367c79a
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/devtools_agent_host_impl.h"
9 #include "ipc/ipc_listener.h"
11 namespace content {
13 class BrowserContext;
14 class DevToolsProtocolHandler;
15 class SharedWorkerInstance;
17 class WorkerDevToolsAgentHost : public DevToolsAgentHostImpl,
18 public IPC::Listener {
19 public:
20 typedef std::pair<int, int> WorkerId;
22 // DevToolsAgentHost override.
23 BrowserContext* GetBrowserContext() override;
24 bool DispatchProtocolMessage(const std::string& message) override;
26 // DevToolsAgentHostImpl overrides.
27 void Attach() override;
28 void Detach() 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 explicit 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 virtual void OnAttachedStateChanged(bool attached);
54 const WorkerId& worker_id() const { return worker_id_; }
56 private:
57 friend class SharedWorkerDevToolsManagerTest;
59 void AttachToWorker();
60 void DetachFromWorker();
61 void WorkerCreated();
62 void OnDispatchOnInspectorFrontend(const DevToolsMessageChunk& message);
64 scoped_ptr<DevToolsProtocolHandler> protocol_handler_;
65 DevToolsMessageChunkProcessor chunk_processor_;
66 WorkerState state_;
67 WorkerId worker_id_;
68 DISALLOW_COPY_AND_ASSIGN(WorkerDevToolsAgentHost);
71 } // namespace content
73 #endif // CONTENT_BROWSER_DEVTOOLS_WORKER_DEVTOOLS_AGENT_HOST_H_