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