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 "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 29 matching lines...) Expand all Loading... |
40 virtual void SendConnectWithNetAddress( | 40 virtual void SendConnectWithNetAddress( |
41 const PP_NetAddress_Private& addr) OVERRIDE; | 41 const PP_NetAddress_Private& addr) OVERRIDE; |
42 virtual void SendSSLHandshake( | 42 virtual void SendSSLHandshake( |
43 const std::string& server_name, | 43 const std::string& server_name, |
44 uint16_t server_port, | 44 uint16_t server_port, |
45 const std::vector<std::vector<char> >& trusted_certs, | 45 const std::vector<std::vector<char> >& trusted_certs, |
46 const std::vector<std::vector<char> >& untrusted_certs) OVERRIDE; | 46 const std::vector<std::vector<char> >& untrusted_certs) OVERRIDE; |
47 virtual void SendRead(int32_t bytes_to_read) OVERRIDE; | 47 virtual void SendRead(int32_t bytes_to_read) OVERRIDE; |
48 virtual void SendWrite(const std::string& buffer) OVERRIDE; | 48 virtual void SendWrite(const std::string& buffer) OVERRIDE; |
49 virtual void SendDisconnect() OVERRIDE; | 49 virtual void SendDisconnect() OVERRIDE; |
50 virtual void SendSetOption(PP_TCPSocket_Option_Dev name, | 50 virtual void SendSetOption(PP_TCPSocket_Option name, |
51 const SocketOptionData& value) OVERRIDE; | 51 const SocketOptionData& value) OVERRIDE; |
52 | 52 |
53 private: | 53 private: |
54 void SendToBrowser(IPC::Message* msg); | 54 void SendToBrowser(IPC::Message* msg); |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(TCPSocket); | 56 DISALLOW_COPY_AND_ASSIGN(TCPSocket); |
57 }; | 57 }; |
58 | 58 |
59 TCPSocket::TCPSocket(const HostResource& resource, uint32 socket_id) | 59 TCPSocket::TCPSocket(const HostResource& resource, uint32 socket_id) |
60 : TCPSocketPrivateImpl(resource, socket_id) { | 60 : TCPSocketPrivateImpl(resource, socket_id) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 | 113 |
114 void TCPSocket::SendDisconnect() { | 114 void TCPSocket::SendDisconnect() { |
115 // After removed from the mapping, this object won't receive any notifications | 115 // After removed from the mapping, this object won't receive any notifications |
116 // from the proxy. | 116 // from the proxy. |
117 DCHECK(g_id_to_socket->find(socket_id_) != g_id_to_socket->end()); | 117 DCHECK(g_id_to_socket->find(socket_id_) != g_id_to_socket->end()); |
118 g_id_to_socket->erase(socket_id_); | 118 g_id_to_socket->erase(socket_id_); |
119 SendToBrowser(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id_)); | 119 SendToBrowser(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id_)); |
120 } | 120 } |
121 | 121 |
122 void TCPSocket::SendSetOption(PP_TCPSocket_Option_Dev name, | 122 void TCPSocket::SendSetOption(PP_TCPSocket_Option name, |
123 const SocketOptionData& value) { | 123 const SocketOptionData& value) { |
124 SendToBrowser( | 124 SendToBrowser( |
125 new PpapiHostMsg_PPBTCPSocket_SetOption(socket_id_, name, value)); | 125 new PpapiHostMsg_PPBTCPSocket_SetOption(socket_id_, name, value)); |
126 } | 126 } |
127 | 127 |
128 void TCPSocket::SendToBrowser(IPC::Message* msg) { | 128 void TCPSocket::SendToBrowser(IPC::Message* msg) { |
129 PluginGlobals::Get()->GetBrowserSender()->Send(msg); | 129 PluginGlobals::Get()->GetBrowserSender()->Send(msg); |
130 } | 130 } |
131 | 131 |
132 } // namespace | 132 } // namespace |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 return; | 254 return; |
255 } | 255 } |
256 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); | 256 IDToSocketMap::iterator iter = g_id_to_socket->find(socket_id); |
257 if (iter == g_id_to_socket->end()) | 257 if (iter == g_id_to_socket->end()) |
258 return; | 258 return; |
259 iter->second->OnSetOptionCompleted(result); | 259 iter->second->OnSetOptionCompleted(result); |
260 } | 260 } |
261 | 261 |
262 } // namespace proxy | 262 } // namespace proxy |
263 } // namespace ppapi | 263 } // namespace ppapi |
OLD | NEW |