| 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/renderer/pepper/ppb_tcp_server_socket_private_impl.h" | 5 #include "content/renderer/pepper/ppb_tcp_server_socket_private_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/renderer/pepper/host_globals.h" | 8 #include "content/renderer/pepper/host_globals.h" |
| 9 #include "content/renderer/pepper/pepper_plugin_delegate_impl.h" | 9 #include "content/renderer/pepper/pepper_helper_impl.h" |
| 10 #include "content/renderer/pepper/ppb_tcp_socket_private_impl.h" | 10 #include "content/renderer/pepper/ppb_tcp_socket_private_impl.h" |
| 11 #include "content/renderer/pepper/resource_helper.h" | 11 #include "content/renderer/pepper/resource_helper.h" |
| 12 #include "ppapi/proxy/ppapi_messages.h" | 12 #include "ppapi/proxy/ppapi_messages.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 PPB_TCPServerSocket_Private_Impl::PPB_TCPServerSocket_Private_Impl( | 16 PPB_TCPServerSocket_Private_Impl::PPB_TCPServerSocket_Private_Impl( |
| 17 PP_Instance instance) | 17 PP_Instance instance) |
| 18 : ::ppapi::PPB_TCPServerSocket_Shared(instance) { | 18 : ::ppapi::PPB_TCPServerSocket_Shared(instance) { |
| 19 } | 19 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 48 remote_addr); | 48 remote_addr); |
| 49 } | 49 } |
| 50 tcp_socket_buffer_ = NULL; | 50 tcp_socket_buffer_ = NULL; |
| 51 | 51 |
| 52 accept_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED); | 52 accept_callback_->Run(succeeded ? PP_OK : PP_ERROR_FAILED); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void PPB_TCPServerSocket_Private_Impl::SendListen( | 55 void PPB_TCPServerSocket_Private_Impl::SendListen( |
| 56 const PP_NetAddress_Private& addr, | 56 const PP_NetAddress_Private& addr, |
| 57 int32_t backlog) { | 57 int32_t backlog) { |
| 58 PepperPluginDelegateImpl* plugin_delegate = GetPluginDelegate(); | 58 PepperHelperImpl* helper = GetHelper(); |
| 59 if (!plugin_delegate) | 59 if (!helper) |
| 60 return; | 60 return; |
| 61 | 61 |
| 62 plugin_delegate->Send(new PpapiHostMsg_PPBTCPServerSocket_Listen( | 62 helper->Send(new PpapiHostMsg_PPBTCPServerSocket_Listen( |
| 63 plugin_delegate->routing_id(), 0, pp_resource(), addr, backlog)); | 63 helper->routing_id(), 0, pp_resource(), addr, backlog)); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void PPB_TCPServerSocket_Private_Impl::SendAccept() { | 66 void PPB_TCPServerSocket_Private_Impl::SendAccept() { |
| 67 PepperPluginDelegateImpl* plugin_delegate = GetPluginDelegate(); | 67 PepperHelperImpl* helper = GetHelper(); |
| 68 if (!plugin_delegate) | 68 if (!helper) |
| 69 return; | 69 return; |
| 70 | 70 |
| 71 plugin_delegate->Send(new PpapiHostMsg_PPBTCPServerSocket_Accept( | 71 helper->Send(new PpapiHostMsg_PPBTCPServerSocket_Accept( |
| 72 plugin_delegate->routing_id(), socket_id_)); | 72 helper->routing_id(), socket_id_)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void PPB_TCPServerSocket_Private_Impl::SendStopListening() { | 75 void PPB_TCPServerSocket_Private_Impl::SendStopListening() { |
| 76 PepperPluginDelegateImpl* plugin_delegate = GetPluginDelegate(); | 76 PepperHelperImpl* helper = GetHelper(); |
| 77 if (!plugin_delegate) | 77 if (!helper) |
| 78 return; | 78 return; |
| 79 | 79 |
| 80 if (socket_id_ != 0) { | 80 if (socket_id_ != 0) { |
| 81 plugin_delegate->Send(new PpapiHostMsg_PPBTCPServerSocket_Destroy( | 81 helper->Send(new PpapiHostMsg_PPBTCPServerSocket_Destroy( |
| 82 socket_id_)); | 82 socket_id_)); |
| 83 plugin_delegate->TCPServerSocketStopListening(socket_id_); | 83 helper->TCPServerSocketStopListening(socket_id_); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 PepperPluginDelegateImpl* | 87 PepperHelperImpl* PPB_TCPServerSocket_Private_Impl::GetHelper() { |
| 88 PPB_TCPServerSocket_Private_Impl::GetPluginDelegate() { | 88 return ResourceHelper::GetHelper(this); |
| 89 return ResourceHelper::GetPluginDelegate(this); | |
| 90 } | 89 } |
| 91 | 90 |
| 92 } // namespace content | 91 } // namespace content |
| OLD | NEW |