Change next_proto member type.
[chromium-blink-merge.git] / content / browser / devtools / embedded_worker_devtools_agent_host.h
blob34adc7f00d02d46734bf2642a35d9afd644ea751
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_EMBEDDED_WORKER_DEVTOOLS_AGENT_HOST_H_
6 #define CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_AGENT_HOST_H_
8 #include "content/browser/devtools/embedded_worker_devtools_manager.h"
9 #include "content/browser/devtools/ipc_devtools_agent_host.h"
10 #include "ipc/ipc_listener.h"
12 namespace content {
14 class BrowserContext;
15 class SharedWorkerInstance;
17 class EmbeddedWorkerDevToolsAgentHost : public IPCDevToolsAgentHost,
18 public IPC::Listener {
19 public:
20 typedef EmbeddedWorkerDevToolsManager::WorkerId WorkerId;
21 typedef EmbeddedWorkerDevToolsManager::ServiceWorkerIdentifier
22 ServiceWorkerIdentifier;
24 EmbeddedWorkerDevToolsAgentHost(WorkerId worker_id,
25 const SharedWorkerInstance& shared_worker);
27 EmbeddedWorkerDevToolsAgentHost(WorkerId worker_id,
28 const ServiceWorkerIdentifier& service_worker,
29 bool debug_service_worker_on_start);
31 // DevToolsAgentHost override.
32 bool IsWorker() const override;
33 Type GetType() override;
34 std::string GetTitle() override;
35 GURL GetURL() override;
36 bool Activate() override;
37 bool Close() override;
38 BrowserContext* GetBrowserContext() override;
40 // IPCDevToolsAgentHost implementation.
41 void SendMessageToAgent(IPC::Message* message) override;
42 void Attach() override;
43 void OnClientAttached() override;
44 void OnClientDetached() override;
46 // IPC::Listener implementation.
47 bool OnMessageReceived(const IPC::Message& msg) override;
49 void WorkerReadyForInspection();
50 void WorkerRestarted(WorkerId worker_id);
51 void WorkerDestroyed();
52 bool Matches(const SharedWorkerInstance& other);
53 bool Matches(const ServiceWorkerIdentifier& other);
54 bool IsTerminated();
56 private:
57 friend class EmbeddedWorkerDevToolsManagerTest;
59 ~EmbeddedWorkerDevToolsAgentHost() override;
61 enum WorkerState {
62 WORKER_UNINSPECTED,
63 WORKER_INSPECTED,
64 WORKER_TERMINATED,
65 WORKER_PAUSED_FOR_DEBUG_ON_START,
66 WORKER_PAUSED_FOR_REATTACH,
69 void AttachToWorker();
70 void DetachFromWorker();
71 void WorkerCreated();
72 void OnDispatchOnInspectorFrontend(const std::string& message,
73 uint32 total_size);
74 void OnSaveAgentRuntimeState(const std::string& state);
76 scoped_ptr<SharedWorkerInstance> shared_worker_;
77 scoped_ptr<ServiceWorkerIdentifier> service_worker_;
78 WorkerState state_;
79 WorkerId worker_id_;
80 std::string saved_agent_state_;
81 DISALLOW_COPY_AND_ASSIGN(EmbeddedWorkerDevToolsAgentHost);
84 } // namespace content
86 #endif // CONTENT_BROWSER_DEVTOOLS_EMBEDDED_WORKER_DEVTOOLS_AGENT_HOST_H_