| 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 #include "ppapi/proxy/ppb_tcp_socket_private_proxy.h" | 5 #include "ppapi/proxy/ppb_tcp_socket_private_proxy.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ppapi/proxy/plugin_dispatcher.h" | 10 #include "ppapi/proxy/plugin_dispatcher.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 g_id_to_socket = new IDToSocketMap(); | 50 g_id_to_socket = new IDToSocketMap(); |
| 51 DCHECK(g_id_to_socket->find(socket_id) == g_id_to_socket->end()); | 51 DCHECK(g_id_to_socket->find(socket_id) == g_id_to_socket->end()); |
| 52 (*g_id_to_socket)[socket_id] = this; | 52 (*g_id_to_socket)[socket_id] = this; |
| 53 } | 53 } |
| 54 | 54 |
| 55 TCPSocket::~TCPSocket() { | 55 TCPSocket::~TCPSocket() { |
| 56 Disconnect(); | 56 Disconnect(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void TCPSocket::SendConnect(const std::string& host, uint16_t port) { | 59 void TCPSocket::SendConnect(const std::string& host, uint16_t port) { |
| 60 SendToBrowser(new PpapiHostMsg_PPBTCPSocket_Connect(socket_id_, host, port)); | 60 SendToBrowser(new PpapiHostMsg_PPBTCPSocket_Connect( |
| 61 API_ID_PPB_TCPSOCKET_PRIVATE, socket_id_, host, port)); |
| 61 } | 62 } |
| 62 | 63 |
| 63 void TCPSocket::SendConnectWithNetAddress(const PP_NetAddress_Private& addr) { | 64 void TCPSocket::SendConnectWithNetAddress(const PP_NetAddress_Private& addr) { |
| 64 SendToBrowser( | 65 SendToBrowser(new PpapiHostMsg_PPBTCPSocket_ConnectWithNetAddress( |
| 65 new PpapiHostMsg_PPBTCPSocket_ConnectWithNetAddress(socket_id_, addr)); | 66 API_ID_PPB_TCPSOCKET_PRIVATE, socket_id_, addr)); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void TCPSocket::SendSSLHandshake(const std::string& server_name, | 69 void TCPSocket::SendSSLHandshake(const std::string& server_name, |
| 69 uint16_t server_port) { | 70 uint16_t server_port) { |
| 70 SendToBrowser(new PpapiHostMsg_PPBTCPSocket_SSLHandshake( | 71 SendToBrowser(new PpapiHostMsg_PPBTCPSocket_SSLHandshake( |
| 71 socket_id_, server_name, server_port)); | 72 socket_id_, server_name, server_port)); |
| 72 } | 73 } |
| 73 | 74 |
| 74 void TCPSocket::SendRead(int32_t bytes_to_read) { | 75 void TCPSocket::SendRead(int32_t bytes_to_read) { |
| 75 SendToBrowser(new PpapiHostMsg_PPBTCPSocket_Read(socket_id_, bytes_to_read)); | 76 SendToBrowser(new PpapiHostMsg_PPBTCPSocket_Read(socket_id_, bytes_to_read)); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 return; | 190 return; |
| 190 } | 191 } |
| 191 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); | 192 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); |
| 192 if (iter == g_id_to_socket->end()) | 193 if (iter == g_id_to_socket->end()) |
| 193 return; | 194 return; |
| 194 iter->second->OnWriteCompleted(succeeded, bytes_written); | 195 iter->second->OnWriteCompleted(succeeded, bytes_written); |
| 195 } | 196 } |
| 196 | 197 |
| 197 } // namespace proxy | 198 } // namespace proxy |
| 198 } // namespace ppapi | 199 } // namespace ppapi |
| OLD | NEW |