Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / browser / devtools / service_worker_devtools_agent_host.h
blob4e6ce3a0824ad16eaba061123196563fd354632a
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_
8 #include <map>
10 #include "content/browser/devtools/service_worker_devtools_manager.h"
11 #include "content/browser/devtools/worker_devtools_agent_host.h"
13 namespace content {
15 class ServiceWorkerDevToolsAgentHost : public WorkerDevToolsAgentHost {
16 public:
17 using List = std::vector<scoped_refptr<ServiceWorkerDevToolsAgentHost>>;
18 using Map = std::map<std::string,
19 scoped_refptr<ServiceWorkerDevToolsAgentHost>>;
20 using ServiceWorkerIdentifier =
21 ServiceWorkerDevToolsManager::ServiceWorkerIdentifier;
23 ServiceWorkerDevToolsAgentHost(WorkerId worker_id,
24 const ServiceWorkerIdentifier& service_worker);
26 void UnregisterWorker();
28 // DevToolsAgentHost override.
29 Type GetType() override;
30 std::string GetTitle() override;
31 GURL GetURL() override;
32 bool Activate() override;
33 bool Close() override;
35 // IPCDevToolsAgentHost override.
36 void OnClientAttached() override;
37 void OnClientDetached() override;
39 bool Matches(const ServiceWorkerIdentifier& other);
41 private:
42 ~ServiceWorkerDevToolsAgentHost() override;
43 scoped_ptr<ServiceWorkerIdentifier> service_worker_;
45 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDevToolsAgentHost);
48 } // namespace content
50 #endif // CONTENT_BROWSER_DEVTOOLS_SERVICE_WORKER_DEVTOOLS_AGENT_HOST_H_