| 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 ccd852d5536f102028f392ef207465aa49dcdf16..ff0f5956993c55f854429d3f9a82cc8ca3ed7f38 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"
|
|
|
| @@ -1682,6 +1684,171 @@ void PepperPluginDelegateImpl::OnConnectTcpACK(
|
| connector->CompleteConnectTcp(socket, local_addr, remote_addr);
|
| }
|
|
|
| +uint32 PepperPluginDelegateImpl::TCPSocketCreate() {
|
| + if (!render_view_->CanUseSocketAPIs())
|
| + return 0;
|
| +
|
| + 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(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(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) {
|
| + webkit::ppapi::PPB_TCPSocket_Private_Impl* socket =
|
| + tcp_sockets_.Lookup(socket_id);
|
| + if (socket)
|
| + 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) {
|
| + webkit::ppapi::PPB_TCPSocket_Private_Impl* socket =
|
| + tcp_sockets_.Lookup(socket_id);
|
| + if (socket)
|
| + 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) {
|
| + webkit::ppapi::PPB_TCPSocket_Private_Impl* socket =
|
| + tcp_sockets_.Lookup(socket_id);
|
| + if (socket)
|
| + 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) {
|
| + webkit::ppapi::PPB_TCPSocket_Private_Impl* socket =
|
| + tcp_sockets_.Lookup(socket_id);
|
| + if (socket)
|
| + socket->OnWriteCompleted(succeeded, bytes_written);
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::TCPSocketDisconnect(uint32 socket_id) {
|
| + // There are no DCHECK(tcp_sockets_.Lookup(socket_id)) because it
|
| + // can be called before
|
| + // TCPSocketConnect/TCPSocketConnectWithNetAddress is called.
|
| + render_view_->Send(new PpapiHostMsg_PPBTCPSocket_Disconnect(socket_id));
|
| + tcp_sockets_.Remove(socket_id);
|
| +}
|
| +
|
| +uint32 PepperPluginDelegateImpl::UDPSocketCreate() {
|
| + if (!render_view_->CanUseSocketAPIs())
|
| + return 0;
|
| +
|
| + 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(socket, socket_id);
|
| + render_view_->Send(new PpapiHostMsg_PPBUDPSocket_Bind(socket_id, addr));
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::OnUDPSocketBindACK(uint32 socket_id,
|
| + bool succeeded) {
|
| + webkit::ppapi::PPB_UDPSocket_Private_Impl* socket =
|
| + udp_sockets_.Lookup(socket_id);
|
| + if (socket)
|
| + 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) {
|
| + webkit::ppapi::PPB_UDPSocket_Private_Impl* socket =
|
| + udp_sockets_.Lookup(socket_id);
|
| + if (socket)
|
| + 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) {
|
| + webkit::ppapi::PPB_UDPSocket_Private_Impl* socket =
|
| + udp_sockets_.Lookup(socket_id);
|
| + if (socket)
|
| + socket->OnSendToCompleted(succeeded, bytes_written);
|
| +}
|
| +
|
| +void PepperPluginDelegateImpl::UDPSocketClose(uint32 socket_id) {
|
| + // There are no DCHECK(udp_sockets_.Lookup(socket_id)) because it
|
| + // can be called before UDPSocketBind is called.
|
| + 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,
|
|
|