| OLD | NEW |
| 1 // Copyright (c) 2012 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 #include "content/browser/renderer_host/p2p/socket_host.h" | 5 #include "content/browser/renderer_host/p2p/socket_host.h" |
| 6 | 6 |
| 7 #include "base/sys_byteorder.h" | 7 #include "base/sys_byteorder.h" |
| 8 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" | 8 #include "content/browser/renderer_host/p2p/socket_host_tcp.h" |
| 9 #include "content/browser/renderer_host/p2p/socket_host_tcp_server.h" | 9 #include "content/browser/renderer_host/p2p/socket_host_tcp_server.h" |
| 10 #include "content/browser/renderer_host/p2p/socket_host_udp.h" | 10 #include "content/browser/renderer_host/p2p/socket_host_udp.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 // static | 67 // static |
| 68 bool P2PSocketHost::IsRequestOrResponse(StunMessageType type) { | 68 bool P2PSocketHost::IsRequestOrResponse(StunMessageType type) { |
| 69 return type == STUN_BINDING_REQUEST || type == STUN_BINDING_RESPONSE || | 69 return type == STUN_BINDING_REQUEST || type == STUN_BINDING_RESPONSE || |
| 70 type == STUN_ALLOCATE_REQUEST || type == STUN_ALLOCATE_RESPONSE; | 70 type == STUN_ALLOCATE_REQUEST || type == STUN_ALLOCATE_RESPONSE; |
| 71 } | 71 } |
| 72 | 72 |
| 73 // static | 73 // static |
| 74 P2PSocketHost* P2PSocketHost::Create( | 74 P2PSocketHost* P2PSocketHost::Create( |
| 75 IPC::Sender* message_sender, int id, P2PSocketType type) { | 75 IPC::Sender* message_sender, int id, P2PSocketType type, |
| 76 net::URLRequestContextGetter* url_context) { |
| 76 switch (type) { | 77 switch (type) { |
| 77 case P2P_SOCKET_UDP: | 78 case P2P_SOCKET_UDP: |
| 78 return new P2PSocketHostUdp(message_sender, id); | 79 return new P2PSocketHostUdp(message_sender, id); |
| 79 | 80 |
| 80 case P2P_SOCKET_TCP_SERVER: | 81 case P2P_SOCKET_TCP_SERVER: |
| 81 return new P2PSocketHostTcpServer( | 82 return new P2PSocketHostTcpServer( |
| 82 message_sender, id, P2P_SOCKET_TCP_CLIENT); | 83 message_sender, id, P2P_SOCKET_TCP_CLIENT); |
| 83 | 84 |
| 84 case P2P_SOCKET_STUN_TCP_SERVER: | 85 case P2P_SOCKET_STUN_TCP_SERVER: |
| 85 return new P2PSocketHostTcpServer( | 86 return new P2PSocketHostTcpServer( |
| 86 message_sender, id, P2P_SOCKET_STUN_TCP_CLIENT); | 87 message_sender, id, P2P_SOCKET_STUN_TCP_CLIENT); |
| 87 | 88 |
| 88 case P2P_SOCKET_TCP_CLIENT: | 89 case P2P_SOCKET_TCP_CLIENT: |
| 89 return new P2PSocketHostTcp(message_sender, id, type); | 90 case P2P_SOCKET_SSLTCP_CLIENT: |
| 91 return new P2PSocketHostTcp(message_sender, id, type, url_context); |
| 90 | 92 |
| 91 case P2P_SOCKET_STUN_TCP_CLIENT: | 93 case P2P_SOCKET_STUN_TCP_CLIENT: |
| 92 return new P2PSocketHostStunTcp(message_sender, id, type); | |
| 93 | |
| 94 case P2P_SOCKET_SSLTCP_CLIENT: | |
| 95 return new P2PSocketHostTcp(message_sender, id, type); | |
| 96 | |
| 97 case P2P_SOCKET_STUN_SSLTCP_CLIENT: | 94 case P2P_SOCKET_STUN_SSLTCP_CLIENT: |
| 98 return new P2PSocketHostStunTcp(message_sender, id, type); | 95 return new P2PSocketHostStunTcp(message_sender, id, type, url_context); |
| 99 } | 96 } |
| 100 | 97 |
| 101 NOTREACHED(); | 98 NOTREACHED(); |
| 102 return NULL; | 99 return NULL; |
| 103 } | 100 } |
| 104 | 101 |
| 105 } // namespace content | 102 } // namespace content |
| OLD | NEW |