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

Unified Diff: content/child/service_worker/navigator_connect_provider.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
« no previous file with comments | « content/child/blink_platform_impl.cc ('k') | content/child/service_worker/navigator_connect_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/service_worker/navigator_connect_provider.h
diff --git a/content/child/service_worker/navigator_connect_provider.h b/content/child/service_worker/navigator_connect_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..b96213187b220da479959bff9e239316b9779d47
--- /dev/null
+++ b/content/child/service_worker/navigator_connect_provider.h
@@ -0,0 +1,56 @@
+// 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_CHILD_SERVICE_WORKER_NAVIGATOR_CONNECT_PROVIDER_H_
+#define CONTENT_CHILD_SERVICE_WORKER_NAVIGATOR_CONNECT_PROVIDER_H_
+
+#include "base/compiler_specific.h"
+#include "base/id_map.h"
+#include "base/memory/ref_counted.h"
+#include "content/child/worker_task_runner.h"
+
+class GURL;
+
+namespace blink {
+template <typename T1, typename T2>
+class WebCallbacks;
+class WebMessagePortChannel;
+class WebString;
+}
+
+namespace content {
+class ThreadSafeSender;
+
+class NavigatorConnectProvider : public WorkerTaskRunner::Observer {
+ public:
+ explicit NavigatorConnectProvider(ThreadSafeSender* thread_safe_sender);
+ ~NavigatorConnectProvider();
+
+ void ConnectToUrl(const GURL& targetUrl,
+ blink::WebMessagePortChannel* port,
+ blink::WebCallbacks<void, blink::WebString>* callbacks);
+
+ void OnNavigatorConnectResult(int thread_id,
+ int request_id,
+ bool allow_connect);
+
+ // |thread_safe_sender| needs to be passed in because if the call leads to
+ // construction it will be needed.
+ static NavigatorConnectProvider* ThreadSpecificInstance(
+ ThreadSafeSender* thread_safe_sender);
+
+ private:
+ // WorkerTaskRunner::Observer implementation.
+ void OnWorkerRunLoopStopped() override;
+
+ scoped_refptr<ThreadSafeSender> thread_safe_sender_;
+ typedef blink::WebCallbacks<void, blink::WebString> ConnectCallback;
+ IDMap<ConnectCallback> requests_;
+
+ DISALLOW_COPY_AND_ASSIGN(NavigatorConnectProvider);
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_SERVICE_WORKER_NAVIGATOR_CONNECT_PROVIDER_H_
« no previous file with comments | « content/child/blink_platform_impl.cc ('k') | content/child/service_worker/navigator_connect_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698