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_SERVICE_WORKER_DEVTOOLS_AGENT_HOST_H_
6 #define CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_AGENT_HOST_H_
10 #include "content/browser/devtools/protocol/network_handler.h"
11 #include "content/browser/devtools/service_worker_devtools_manager.h"
12 #include "content/browser/devtools/worker_devtools_agent_host.h"
16 class ServiceWorkerDevToolsAgentHost
: public WorkerDevToolsAgentHost
{
18 using List
= std::vector
<scoped_refptr
<ServiceWorkerDevToolsAgentHost
>>;
19 using Map
= std::map
<std::string
,
20 scoped_refptr
<ServiceWorkerDevToolsAgentHost
>>;
21 using ServiceWorkerIdentifier
=
22 ServiceWorkerDevToolsManager::ServiceWorkerIdentifier
;
24 ServiceWorkerDevToolsAgentHost(WorkerId worker_id
,
25 const ServiceWorkerIdentifier
& service_worker
);
27 void UnregisterWorker();
29 // DevToolsAgentHost overrides.
30 Type
GetType() override
;
31 std::string
GetTitle() override
;
32 GURL
GetURL() override
;
33 bool Activate() override
;
34 bool Close() override
;
36 // WorkerDevToolsAgentHost overrides.
37 void OnAttachedStateChanged(bool attached
) override
;
39 int64
service_worker_version_id() const;
41 bool Matches(const ServiceWorkerIdentifier
& other
);
44 ~ServiceWorkerDevToolsAgentHost() override
;
45 scoped_ptr
<ServiceWorkerIdentifier
> service_worker_
;
46 scoped_ptr
<devtools::network::NetworkHandler
> network_handler_
;
48 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDevToolsAgentHost
);
51 } // namespace content
53 #endif // CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_AGENT_HOST_H_