Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(833)

Unified Diff: content/browser/devtools/protocol/service_worker_handler.h

Issue 976353002: DevTools: land service worker handler (patch 1). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@worker2
Patch Set: review comments addressed Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/devtools/protocol/service_worker_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/protocol/service_worker_handler.h
diff --git a/content/browser/devtools/protocol/service_worker_handler.h b/content/browser/devtools/protocol/service_worker_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..0f2f4f707445caf323370a25549a065d5bd94efc
--- /dev/null
+++ b/content/browser/devtools/protocol/service_worker_handler.h
@@ -0,0 +1,61 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_
+#define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_
+
+#include <set>
+
+#include "content/browser/devtools/protocol/devtools_protocol_handler.h"
+#include "content/browser/devtools/worker_devtools_manager.h"
+#include "content/public/browser/devtools_agent_host.h"
+#include "content/public/browser/devtools_agent_host_client.h"
+
+namespace content {
+namespace devtools {
+namespace service_worker {
+
+class ServiceWorkerHandler : public DevToolsAgentHostClient,
+ public WorkerDevToolsManager::Observer {
+ public:
+ typedef DevToolsProtocolClient::Response Response;
+
+ ServiceWorkerHandler();
+ ~ServiceWorkerHandler() override;
+
+ void SetClient(scoped_ptr<DevToolsProtocolClient> client);
+ void Detached();
+
+ // Protocol 'service worker' domain implementation.
+ Response Enable();
+ Response Disable();
+ Response SendMessage(const std::string& worker_id,
+ const std::string& message);
+ Response Attach(const std::string& worker_id);
+ Response Detach(const std::string& worker_id);
+
+ // WorkerDevToolsManager::Observer implementation.
+ void WorkerCreated(DevToolsAgentHost* host) override;
+ void WorkerDestroyed(DevToolsAgentHost* host) override;
+
+ private:
+ // DevToolsAgentHostClient overrides.
+ void DispatchProtocolMessage(DevToolsAgentHost* agent_host,
+ const std::string& message) override;
+ void AgentHostClosed(DevToolsAgentHost* agent_host,
+ bool replaced_with_another_client) override;
+
+ scoped_ptr<DevToolsProtocolClient> client_;
+ using AttachedHosts = std::map<std::string,
+ scoped_refptr<DevToolsAgentHost>>;
+ AttachedHosts attached_hosts_;
+
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerHandler);
+};
+
+} // namespace service_worker
+} // namespace devtools
+} // namespace content
+
+#endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SERVICE_WORKER_HANDLER_H_
« no previous file with comments | « no previous file | content/browser/devtools/protocol/service_worker_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698