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

Unified Diff: content/browser/service_worker/navigator_connect_message_handler.h

Issue 668303004: WIP DO NOT COMMIT chromium side of navigator.connect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years 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
Index: content/browser/service_worker/navigator_connect_message_handler.h
diff --git a/content/browser/service_worker/navigator_connect_message_handler.h b/content/browser/service_worker/navigator_connect_message_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..ad1acb93096c6d5b8eb10163a7ddde55f95270ae
--- /dev/null
+++ b/content/browser/service_worker/navigator_connect_message_handler.h
@@ -0,0 +1,53 @@
+// Copyright 2014 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_SERVICE_WORKER_NAVIGATOR_CONNECT_MESSAGE_HANDLER_H_
+#define CONTENT_BROWSER_SERVICE_WORKER_NAVIGATOR_CONNECT_MESSAGE_HANDLER_H_
+
+#include <map>
+
+#include "content/browser/message_port_message_filter.h"
+#include "content/common/service_worker/service_worker_status_code.h"
+
+namespace content {
+
+struct CrossOriginServiceWorkerClient;
+class ServiceWorkerContextCore;
+class ServiceWorkerRegistration;
+
+class NavigatorConnectMessageHandler : public MessagePortHandler {
+ public:
+ explicit NavigatorConnectMessageHandler(
+ base::WeakPtr<ServiceWorkerContextCore> context);
+ ~NavigatorConnectMessageHandler() override;
+
+ void RegisterMessagePort(const CrossOriginServiceWorkerClient& client);
+ void ClearRegistration(int message_port_id);
+ void SetServiceWorkerRegistation(
+ int message_port_id,
+ const scoped_refptr<ServiceWorkerRegistration>&
+ service_worker_registration);
+
+ // MessagePortHandler implementation.
+ void SendMessage(int route_id,
+ const base::string16& message,
+ const std::vector<int>& sent_message_port_ids) override;
+ void SendMessagesQueued(int route_id) override;
+
+ private:
+ void DoSendMessage(const CrossOriginServiceWorkerClient& client,
+ const base::string16& message,
+ const std::vector<int>& sent_message_port_ids,
+ ServiceWorkerStatusCode service_worker_status,
+ const scoped_refptr<ServiceWorkerRegistration>&
+ service_worker_registration);
+
+ base::WeakPtr<ServiceWorkerContextCore> context_;
+ struct MessagePort;
+ std::map<int, MessagePort> ports_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_SERVICE_WORKER_NAVIGATOR_CONNECT_MESSAGE_HANDLER_H_
« no previous file with comments | « content/browser/message_port_service.cc ('k') | content/browser/service_worker/navigator_connect_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698