| Index: content/renderer/pepper_plugin_delegate_impl.cc
|
| diff --git a/content/renderer/pepper_plugin_delegate_impl.cc b/content/renderer/pepper_plugin_delegate_impl.cc
|
| index 65645f1efd0b5f94813cbf985794532e5bd155b5..db709bd297588f36b0c7eba3ee656889d5e0b0e7 100644
|
| --- a/content/renderer/pepper_plugin_delegate_impl.cc
|
| +++ b/content/renderer/pepper_plugin_delegate_impl.cc
|
| @@ -75,6 +75,8 @@
|
| #include "webkit/plugins/ppapi/ppb_broker_impl.h"
|
| #include "webkit/plugins/ppapi/ppb_flash_impl.h"
|
| #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h"
|
| +#include "webkit/plugins/ppapi/ppb_tcp_socket_private_impl.h"
|
| +#include "webkit/plugins/ppapi/ppb_udp_socket_private_impl.h"
|
| #include "webkit/plugins/ppapi/resource_helper.h"
|
| #include "webkit/plugins/webplugininfo.h"
|
|
|
| @@ -1679,6 +1681,174 @@ void PepperPluginDelegateImpl::OnConnectTcpACK(
|
| connector->CompleteConnectTcp(socket, local_addr, remote_addr);
|
| }
|
|
|
| +uint32 PepperPluginDelegateImpl::TCPSocketCreate() {
|
| + uint32 socket_id = 0;
|
| + render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Create(
|
| + render_view_->routing_id(), 0, &socket_id));
|
| + return socket_id;
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::TCPSocketConnect(
|
| + webkit::ppapi::PPB_TCPSocket_Private_Impl* socket,
|
| + uint32 socket_id,
|
| + const std::string& host,
|
| + uint16_t port) {
|
| + tcp_sockets_.AddWithID(
|
| + new scoped_refptr<webkit::ppapi::PPB_TCPSocket_Private_Impl>(socket),
|
| + socket_id);
|
| + render_view_->Send(
|
| + new PpapiHostMsg_PPBTCPSocket_Connect(socket_id, host, port));
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::TCPSocketConnectWithNetAddress(
|
| + webkit::ppapi::PPB_TCPSocket_Private_Impl* socket,
|
| + uint32 socket_id,
|
| + const PP_NetAddress_Private& addr) {
|
| + tcp_sockets_.AddWithID(
|
| + new scoped_refptr<webkit::ppapi::PPB_TCPSocket_Private_Impl>(socket),
|
| + socket_id);
|
| + render_view_->Send(
|
| + new PpapiHostMsg_PPBTCPSocket_ConnectWithNetAddress(socket_id, addr));
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::OnTCPSocketConnectACK(
|
| + uint32 socket_id,
|
| + bool succeeded,
|
| + const PP_NetAddress_Private& local_addr,
|
| + const PP_NetAddress_Private& remote_addr) {
|
| + DCHECK(tcp_sockets_.Lookup(socket_id));
|
| + scoped_refptr<webkit::ppapi::PPB_TCPSocket_Private_Impl> socket =
|
| + *tcp_sockets_.Lookup(socket_id);
|
| + if (socket.get())
|
| + socket->OnConnectCompleted(succeeded, local_addr, remote_addr);
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::TCPSocketSSLHandshake(uint32 socket_id,
|
| + const std::string& server_name,
|
| + uint16_t server_port) {
|
| + DCHECK(tcp_sockets_.Lookup(socket_id));
|
| + render_view_->Send(new PpapiHostMsg_PPBTCPSocket_SSLHandshake(
|
| + socket_id, server_name, server_port));
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::OnTCPSocketSSLHandshakeACK(uint32 socket_id,
|
| + bool succeeded) {
|
| + DCHECK(tcp_sockets_.Lookup(socket_id));
|
| + scoped_refptr<webkit::ppapi::PPB_TCPSocket_Private_Impl> socket =
|
| + *tcp_sockets_.Lookup(socket_id);
|
| + if (socket.get())
|
| + socket->OnSSLHandshakeCompleted(succeeded);
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::TCPSocketRead(uint32 socket_id,
|
| + int32_t bytes_to_read) {
|
| + DCHECK(tcp_sockets_.Lookup(socket_id));
|
| + render_view_->Send(
|
| + new PpapiHostMsg_PPBTCPSocket_Read(socket_id, bytes_to_read));
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::OnTCPSocketReadACK(uint32 socket_id,
|
| + bool succeeded,
|
| + const std::string& data) {
|
| + DCHECK(tcp_sockets_.Lookup(socket_id));
|
| + scoped_refptr<webkit::ppapi::PPB_TCPSocket_Private_Impl> socket =
|
| + *tcp_sockets_.Lookup(socket_id);
|
| + if (socket.get())
|
| + socket->OnReadCompleted(succeeded, data);
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::TCPSocketWrite(uint32 socket_id,
|
| + const std::string& buffer) {
|
| + DCHECK(tcp_sockets_.Lookup(socket_id));
|
| + render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Write(socket_id, buffer));
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::OnTCPSocketWriteACK(uint32 socket_id,
|
| + bool succeeded,
|
| + int32_t bytes_written) {
|
| + DCHECK(tcp_sockets_.Lookup(socket_id));
|
| + scoped_refptr<webkit::ppapi::PPB_TCPSocket_Private_Impl> socket =
|
| + *tcp_sockets_.Lookup(socket_id);
|
| + if (socket.get())
|
| + socket->OnWriteCompleted(succeeded, bytes_written);
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::TCPSocketDisconnect(uint32 socket_id) {
|
| + DCHECK(tcp_sockets_.Lookup(socket_id));
|
| + render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id));
|
| + tcp_sockets_.Remove(socket_id);
|
| +}
|
| +
|
| +uint32 PepperPluginDelegateImpl::UDPSocketCreate() {
|
| + uint32 socket_id = 0;
|
| + render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Create(
|
| + render_view_->routing_id(), 0, &socket_id));
|
| + return socket_id;
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::UDPSocketBind(
|
| + webkit::ppapi::PPB_UDPSocket_Private_Impl* socket,
|
| + uint32 socket_id,
|
| + const PP_NetAddress_Private& addr) {
|
| + udp_sockets_.AddWithID(
|
| + new scoped_refptr<webkit::ppapi::PPB_UDPSocket_Private_Impl>(socket),
|
| + socket_id);
|
| + render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Bind(socket_id, addr));
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::OnUDPSocketBindACK(uint32 socket_id,
|
| + bool succeeded) {
|
| + DCHECK(udp_sockets_.Lookup(socket_id));
|
| + scoped_refptr<webkit::ppapi::PPB_UDPSocket_Private_Impl> socket =
|
| + *udp_sockets_.Lookup(socket_id);
|
| + if (socket.get())
|
| + socket->OnBindCompleted(succeeded);
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::UDPSocketRecvFrom(uint32 socket_id,
|
| + int32_t num_bytes) {
|
| + DCHECK(udp_sockets_.Lookup(socket_id));
|
| + render_view_->Send(
|
| + new PpapiHostMsg_PPBUDPSocket_RecvFrom(socket_id, num_bytes));
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::OnUDPSocketRecvFromACK(
|
| + uint32 socket_id,
|
| + bool succeeded,
|
| + const std::string& data,
|
| + const PP_NetAddress_Private& remote_addr) {
|
| + DCHECK(udp_sockets_.Lookup(socket_id));
|
| + scoped_refptr<webkit::ppapi::PPB_UDPSocket_Private_Impl> socket =
|
| + *udp_sockets_.Lookup(socket_id);
|
| + if (socket.get())
|
| + socket->OnRecvFromCompleted(succeeded, data, remote_addr);
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::UDPSocketSendTo(
|
| + uint32 socket_id,
|
| + const std::string& buffer,
|
| + const PP_NetAddress_Private& net_addr) {
|
| + DCHECK(udp_sockets_.Lookup(socket_id));
|
| + render_view_->Send(
|
| + new PpapiHostMsg_PPBUDPSocket_SendTo(socket_id, buffer, net_addr));
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::OnUDPSocketSendToACK(uint32 socket_id,
|
| + bool succeeded,
|
| + int32_t bytes_written) {
|
| + DCHECK(udp_sockets_.Lookup(socket_id));
|
| + scoped_refptr<webkit::ppapi::PPB_UDPSocket_Private_Impl> socket =
|
| + *udp_sockets_.Lookup(socket_id);
|
| + if (socket.get())
|
| + socket->OnSendToCompleted(succeeded, bytes_written);
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::UDPSocketClose(uint32 socket_id) {
|
| + DCHECK(udp_sockets_.Lookup(socket_id));
|
| + render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Close(socket_id));
|
| + udp_sockets_.Remove(socket_id);
|
| +}
|
| +
|
| int32_t PepperPluginDelegateImpl::ShowContextMenu(
|
| webkit::ppapi::PluginInstance* instance,
|
| webkit::ppapi::PPB_Flash_Menu_Impl* menu,
|
|
|