OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_ | 5 #ifndef CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_ |
6 #define CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_ | 6 #define CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "third_party/libjingle/source/talk/base/packetsocketfactory.h" | 10 #include "third_party/libjingle/source/talk/base/packetsocketfactory.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 class P2PSocketDispatcher; | 14 class P2PSocketDispatcher; |
15 | 15 |
16 // IpcPacketSocketFactory implements talk_base::PacketSocketFactory | 16 // IpcPacketSocketFactory implements talk_base::PacketSocketFactory |
17 // interface for libjingle using IPC-based P2P sockets. The class must | 17 // interface for libjingle using IPC-based P2P sockets. The class must |
18 // be used on a thread that is a libjingle thread (implements | 18 // be used on a thread that is a libjingle thread (implements |
19 // talk_base::Thread) and also has associated base::MessageLoop. Each | 19 // talk_base::Thread) and also has associated base::MessageLoop. Each |
20 // socket created by the factory must be used on the thread it was | 20 // socket created by the factory must be used on the thread it was |
21 // created on. | 21 // created on. |
22 class IpcPacketSocketFactory : public talk_base::PacketSocketFactory { | 22 class IpcPacketSocketFactory : public talk_base::PacketSocketFactory { |
23 public: | 23 public: |
24 CONTENT_EXPORT explicit IpcPacketSocketFactory( | 24 CONTENT_EXPORT explicit IpcPacketSocketFactory( |
25 P2PSocketDispatcher* socket_dispatcher); | 25 P2PSocketDispatcher* socket_dispatcher); |
26 virtual ~IpcPacketSocketFactory(); | 26 virtual ~IpcPacketSocketFactory(); |
27 | 27 |
28 virtual talk_base::AsyncPacketSocket* CreateUdpSocket( | 28 virtual talk_base::AsyncPacketSocket* CreateUdpSocket( |
29 const talk_base::SocketAddress& local_address, | 29 const talk_base::SocketAddress& local_address, |
30 int min_port, int max_port); | 30 int min_port, int max_port) OVERRIDE; |
31 virtual talk_base::AsyncPacketSocket* CreateServerTcpSocket( | 31 virtual talk_base::AsyncPacketSocket* CreateServerTcpSocket( |
32 const talk_base::SocketAddress& local_address, | 32 const talk_base::SocketAddress& local_address, |
33 int min_port, | 33 int min_port, |
34 int max_port, | 34 int max_port, |
35 bool ssl); | 35 bool ssl) OVERRIDE; |
36 virtual talk_base::AsyncPacketSocket* CreateClientTcpSocket( | 36 virtual talk_base::AsyncPacketSocket* CreateClientTcpSocket( |
37 const talk_base::SocketAddress& local_address, | 37 const talk_base::SocketAddress& local_address, |
38 const talk_base::SocketAddress& remote_address, | 38 const talk_base::SocketAddress& remote_address, |
39 const talk_base::ProxyInfo& proxy_info, | 39 const talk_base::ProxyInfo& proxy_info, |
40 const std::string& user_agent, | 40 const std::string& user_agent, |
41 bool ssl); | 41 bool ssl) OVERRIDE; |
42 | 42 |
43 private: | 43 private: |
44 P2PSocketDispatcher* socket_dispatcher_; | 44 P2PSocketDispatcher* socket_dispatcher_; |
45 | 45 |
46 DISALLOW_COPY_AND_ASSIGN(IpcPacketSocketFactory); | 46 DISALLOW_COPY_AND_ASSIGN(IpcPacketSocketFactory); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace content | 49 } // namespace content |
50 | 50 |
51 #endif // CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_ | 51 #endif // CONTENT_RENDERER_P2P_IPC_SOCKET_FACTORY_H_ |
OLD | NEW |