| Index: webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc
|
| diff --git a/webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc b/webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc
|
| index 61fc83c4c14656cbe7f34a0bfa46d37f0506ad9f..06489aa593792da0f037bc47f97abc9923546344 100644
|
| --- a/webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc
|
| +++ b/webkit/plugins/ppapi/ppb_tcp_socket_private_impl.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| @@ -22,11 +22,10 @@ PPB_TCPSocket_Private_Impl::~PPB_TCPSocket_Private_Impl() {
|
| }
|
|
|
| PP_Resource PPB_TCPSocket_Private_Impl::CreateResource(PP_Instance instance) {
|
| - PluginInstance* plugin_instance = HostGlobals::Get()->GetInstance(instance);
|
| - if (!plugin_instance)
|
| + PluginDelegate* plugin_delegate = GetPluginDelegate(instance);
|
| + if (!plugin_delegate)
|
| return 0;
|
|
|
| - PluginDelegate* plugin_delegate = plugin_instance->delegate();
|
| uint32 socket_id = plugin_delegate->TCPSocketCreate();
|
| if (!socket_id)
|
| return 0;
|
| @@ -34,6 +33,27 @@ PP_Resource PPB_TCPSocket_Private_Impl::CreateResource(PP_Instance instance) {
|
| return (new PPB_TCPSocket_Private_Impl(instance, socket_id))->GetReference();
|
| }
|
|
|
| +PP_Resource PPB_TCPSocket_Private_Impl::CreateConnectedSocket(
|
| + PP_Instance instance,
|
| + uint32 socket_id,
|
| + const PP_NetAddress_Private& local_addr,
|
| + const PP_NetAddress_Private& remote_addr) {
|
| + PluginDelegate* plugin_delegate = GetPluginDelegate(instance);
|
| + if (!plugin_delegate)
|
| + return 0;
|
| +
|
| + PPB_TCPSocket_Private_Impl* socket =
|
| + new PPB_TCPSocket_Private_Impl(instance, socket_id);
|
| +
|
| + socket->connection_state_ = PPB_TCPSocket_Private_Impl::CONNECTED;
|
| + socket->local_addr_ = local_addr;
|
| + socket->remote_addr_ = remote_addr;
|
| +
|
| + plugin_delegate->RegisterTCPSocket(socket, socket_id);
|
| +
|
| + return socket->GetReference();
|
| +}
|
| +
|
| void PPB_TCPSocket_Private_Impl::SendConnect(const std::string& host,
|
| uint16_t port) {
|
| PluginDelegate* plugin_delegate = ResourceHelper::GetPluginDelegate(this);
|
| @@ -87,5 +107,13 @@ void PPB_TCPSocket_Private_Impl::SendDisconnect() {
|
| plugin_delegate->TCPSocketDisconnect(socket_id_);
|
| }
|
|
|
| +PluginDelegate* PPB_TCPSocket_Private_Impl::GetPluginDelegate(
|
| + PP_Instance instance) {
|
| + PluginInstance* plugin_instance = HostGlobals::Get()->GetInstance(instance);
|
| + if (!plugin_instance)
|
| + return NULL;
|
| + return plugin_instance->delegate();
|
| +}
|
| +
|
| } // namespace ppapi
|
| } // namespace webkit
|
|
|