OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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. | |
4 | |
5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_ | |
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_ | |
7 | |
8 #include <set> | |
9 | |
10 #include "content/browser/devtools/protocol/devtools_protocol_handler.h" | |
11 | |
dgozman
2015/03/05 20:17:06
nit: remove blank line
pfeldman
2015/03/05 20:26:26
Done.
| |
12 #include "content/browser/devtools/worker_devtools_manager.h" | |
13 #include "content/public/browser/devtools_agent_host.h" | |
14 #include "content/public/browser/devtools_agent_host_client.h" | |
15 | |
16 namespace content { | |
17 namespace devtools { | |
18 namespace service_worker { | |
19 | |
20 class ServiceWorkerHandler : public DevToolsAgentHostClient, | |
21 public WorkerDevToolsManager::Observer { | |
22 public: | |
23 typedef DevToolsProtocolClient::Response Response; | |
24 | |
25 ServiceWorkerHandler(); | |
26 ~ServiceWorkerHandler() override; | |
27 | |
28 void SetClient(scoped_ptr<DevToolsProtocolClient> client); | |
29 void Detached(); | |
30 | |
31 // Protocol 'worker domain' implementation. | |
dgozman
2015/03/05 20:17:06
worker -> service worker
pfeldman
2015/03/05 20:26:26
Done.
| |
32 Response Enable(); | |
33 Response Disable(); | |
34 Response SendMessage(const std::string& worker_id, | |
35 const std::string& message); | |
36 Response Attach(const std::string& worker_id); | |
37 Response Detach(const std::string& worker_id); | |
38 | |
39 // WorkerDevToolsManager::Observer implementation. | |
40 void WorkerCreated(scoped_refptr<DevToolsAgentHost> host) override; | |
41 void WorkerDestroyed(scoped_refptr<DevToolsAgentHost> host) override; | |
42 | |
43 private: | |
44 // DevToolsProtocolClient overrides. | |
dgozman
2015/03/05 20:17:06
DevToolsAgentHostClient
pfeldman
2015/03/05 20:26:26
Done.
| |
45 void DispatchProtocolMessage(DevToolsAgentHost* agent_host, | |
46 const std::string& message) override; | |
47 void AgentHostClosed(DevToolsAgentHost* agent_host, | |
48 bool replaced_with_another_client) override; | |
49 | |
50 scoped_ptr<DevToolsProtocolClient> client_; | |
51 using AttachedHosts = std::map<std::string, | |
52 scoped_refptr<DevToolsAgentHost>>; | |
53 AttachedHosts attached_hosts_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandler); | |
56 }; | |
57 | |
58 } // namespace worker | |
dgozman
2015/03/05 20:17:06
service_worker
pfeldman
2015/03/05 20:26:26
Done.
| |
59 } // namespace devtools | |
60 } // namespace content | |
61 | |
62 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_ | |
OLD | NEW |