OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // P2PSocketDispatcher is a per-renderer object that dispatchers all | 5 // P2PSocketDispatcher is a per-renderer object that dispatchers all |
6 // P2P messages received from the browser and relays all P2P messages | 6 // P2P messages received from the browser and relays all P2P messages |
7 // sent to the browser. P2PSocketClient instances register themselves | 7 // sent to the browser. P2PSocketClient instances register themselves |
8 // with the dispatcher using RegisterClient() and UnregisterClient(). | 8 // with the dispatcher using RegisterClient() and UnregisterClient(). |
9 // | 9 // |
10 // Relationship of classes. | 10 // Relationship of classes. |
11 // | 11 // |
12 // P2PSocketHost P2PSocketClient | 12 // P2PSocketHost P2PSocketClient |
13 // ^ ^ | 13 // ^ ^ |
14 // | | | 14 // | | |
15 // v IPC v | 15 // v IPC v |
16 // P2PSocketDispatcherHost <---------> P2PSocketDispatcher | 16 // P2PSocketDispatcherHost <---------> P2PSocketDispatcher |
17 // | 17 // |
18 | 18 |
19 #ifndef CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ | 19 #ifndef CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ |
20 #define CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ | 20 #define CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ |
21 | 21 |
22 #include <vector> | 22 #include <vector> |
23 | 23 |
24 #include "base/callback_forward.h" | 24 #include "base/callback_forward.h" |
25 #include "base/compiler_specific.h" | 25 #include "base/compiler_specific.h" |
26 #include "base/id_map.h" | 26 #include "base/id_map.h" |
27 #include "base/observer_list_threadsafe.h" | 27 #include "base/observer_list_threadsafe.h" |
28 #include "base/synchronization/lock.h" | 28 #include "base/synchronization/lock.h" |
| 29 #include "content/common/content_export.h" |
29 #include "content/common/p2p_sockets.h" | 30 #include "content/common/p2p_sockets.h" |
30 #include "content/public/renderer/render_view_observer.h" | 31 #include "content/public/renderer/render_view_observer.h" |
31 #include "net/base/net_util.h" | 32 #include "net/base/net_util.h" |
32 | 33 |
33 class RenderViewImpl; | 34 class RenderViewImpl; |
34 | 35 |
35 namespace base { | 36 namespace base { |
36 class MessageLoopProxy; | 37 class MessageLoopProxy; |
37 } // namespace base | 38 } // namespace base |
38 | 39 |
39 namespace net { | 40 namespace net { |
40 class IPEndPoint; | 41 class IPEndPoint; |
41 } // namespace net | 42 } // namespace net |
42 | 43 |
43 namespace content { | 44 namespace content { |
44 | 45 |
45 class P2PHostAddressRequest; | 46 class P2PHostAddressRequest; |
46 class P2PSocketClient; | 47 class P2PSocketClient; |
47 | 48 |
48 // P2PSocketDispatcher works on the renderer thread. It dispatches all | 49 // P2PSocketDispatcher works on the renderer thread. It dispatches all |
49 // messages on that thread, and all its methods must be called on the | 50 // messages on that thread, and all its methods must be called on the |
50 // same thread. | 51 // same thread. |
51 class P2PSocketDispatcher : public content::RenderViewObserver { | 52 class CONTENT_EXPORT P2PSocketDispatcher : public content::RenderViewObserver { |
52 public: | 53 public: |
53 class NetworkListObserver { | 54 class NetworkListObserver { |
54 public: | 55 public: |
55 virtual ~NetworkListObserver() { } | 56 virtual ~NetworkListObserver() { } |
56 | 57 |
57 virtual void OnNetworkListChanged( | 58 virtual void OnNetworkListChanged( |
58 const net::NetworkInterfaceList& list) = 0; | 59 const net::NetworkInterfaceList& list) = 0; |
59 | 60 |
60 protected: | 61 protected: |
61 NetworkListObserver() { } | 62 NetworkListObserver() { } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 network_list_observers_; | 117 network_list_observers_; |
117 | 118 |
118 scoped_refptr<AsyncMessageSender> async_message_sender_; | 119 scoped_refptr<AsyncMessageSender> async_message_sender_; |
119 | 120 |
120 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher); | 121 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcher); |
121 }; | 122 }; |
122 | 123 |
123 } // namespace content | 124 } // namespace content |
124 | 125 |
125 #endif // CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ | 126 #endif // CONTENT_RENDERER_P2P_SOCKET_DISPATCHER_H_ |
OLD | NEW |