OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef CONTENT_CHILD_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_PROVIDER_H_ | |
6 #define CONTENT_CHILD_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_PROVIDER_H_ | |
7 | |
8 #include "base/compiler_specific.h" | |
9 #include "base/id_map.h" | |
10 #include "base/memory/ref_counted.h" | |
11 #include "content/child/worker_task_runner.h" | |
12 #include "third_party/WebKit/public/platform/WebNavigatorConnectProvider.h" | |
13 | |
14 class GURL; | |
15 | |
16 namespace blink { | |
17 template <typename T1, typename T2> | |
18 class WebCallbacks; | |
19 class WebMessagePortChannel; | |
20 class WebString; | |
21 } | |
22 | |
23 namespace content { | |
24 class ThreadSafeSender; | |
25 | |
26 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.
| |
27 public WorkerTaskRunner::Observer { | |
28 public: | |
29 explicit NavigatorConnectProvider(ThreadSafeSender* thread_safe_sender); | |
30 ~NavigatorConnectProvider(); | |
31 | |
32 // WebNavigatorConnectProvider implementation. | |
33 virtual void connect(const blink::WebURL& targetUrl, | |
34 blink::WebMessagePortChannel* port, | |
35 blink::WebCallbacks<void, void>* callbacks); | |
36 | |
37 void OnConnectResult(int thread_id, int request_id, bool allow_connect); | |
38 | |
39 // |thread_safe_sender| needs to be passed in because if the call leads to | |
40 // construction it will be needed. | |
41 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
| |
42 ThreadSafeSender* thread_safe_sender); | |
43 | |
44 private: | |
45 // WorkerTaskRunner::Observer implementation. | |
46 void OnWorkerRunLoopStopped() override; | |
47 | |
48 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | |
49 typedef blink::WebCallbacks<void, void> ConnectCallback; | |
50 IDMap<ConnectCallback> requests_; | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(NavigatorConnectProvider); | |
53 }; | |
54 | |
55 } // namespace content | |
56 | |
57 #endif // CONTENT_CHILD_NAVIGATOR_CONNECT_NAVIGATOR_CONNECT_PROVIDER_H_ | |
OLD | NEW |