Chromium Code Reviews| Index: content/child/navigator_connect/navigator_connect_provider.h |
| diff --git a/content/child/navigator_connect/navigator_connect_provider.h b/content/child/navigator_connect/navigator_connect_provider.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7f5b8494718968ee35a230928e744654fba03c97 |
| --- /dev/null |
| +++ b/content/child/navigator_connect/navigator_connect_provider.h |
| @@ -0,0 +1,57 @@ |
| +// 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_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_PROVIDER_H_ |
| +#define CONTENT_CHILD_NAVIGATOR_CONNECT_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" |
| +#include "third_party/WebKit/public/platform/WebNavigatorConnectProvider.h" |
| + |
| +class GURL; |
| + |
| +namespace blink { |
| +template <typename T1, typename T2> |
| +class WebCallbacks; |
| +class WebMessagePortChannel; |
| +class WebString; |
| +} |
| + |
| +namespace content { |
| +class ThreadSafeSender; |
| + |
| +class NavigatorConnectProvider : public blink::WebNavigatorConnectProvider, |
|
scheib
2014/12/05 05:49:50
Definitely mention ownership of instances of this
Marijn Kruisselbrink
2014/12/05 14:25:50
Done.
|
| + public WorkerTaskRunner::Observer { |
| + public: |
| + explicit NavigatorConnectProvider(ThreadSafeSender* thread_safe_sender); |
| + ~NavigatorConnectProvider(); |
| + |
| + // WebNavigatorConnectProvider implementation. |
| + virtual void connect(const blink::WebURL& targetUrl, |
| + blink::WebMessagePortChannel* port, |
| + blink::WebCallbacks<void, void>* callbacks); |
| + |
| + void OnConnectResult(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( |
|
scheib
2014/12/05 05:49:50
Perhaps GetOrCreateThreadspecificInstance
Marijn Kruisselbrink
2014/12/05 14:25:50
Maybe... PushProvider and NotificationManager call
|
| + ThreadSafeSender* thread_safe_sender); |
| + |
| + private: |
| + // WorkerTaskRunner::Observer implementation. |
| + void OnWorkerRunLoopStopped() override; |
| + |
| + scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| + typedef blink::WebCallbacks<void, void> ConnectCallback; |
| + IDMap<ConnectCallback> requests_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(NavigatorConnectProvider); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_CHILD_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_PROVIDER_H_ |