Pepper: Remove ppapi/cpp/private/flash_tcp_socket.*.

I've converted Flapper, so we don't need them any longer. However, we still need
to support the C interfaces for some time (for binary compatibility).

Review URL: http://codereview.chromium.org/8597018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110788 0039d316-1c4b-4281-b951-d872f2087c98
parent 477ae05f
// Copyright (c) 2011 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.
#include "ppapi/cpp/private/flash_tcp_socket.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/cpp/completion_callback.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/module_impl.h"
namespace pp {
namespace {
template <> const char* interface_name<PPB_Flash_TCPSocket>() {
return PPB_FLASH_TCPSOCKET_INTERFACE;
}
} // namespace
namespace flash {
TCPSocket::TCPSocket(Instance* instance) {
if (has_interface<PPB_Flash_TCPSocket>() && instance) {
PassRefFromConstructor(get_interface<PPB_Flash_TCPSocket>()->Create(
instance->pp_instance()));
}
}
// static
bool TCPSocket::IsAvailable() {
return has_interface<PPB_Flash_TCPSocket>();
}
int32_t TCPSocket::Connect(const char* host,
uint16_t port,
const CompletionCallback& callback) {
if (!has_interface<PPB_Flash_TCPSocket>())
return callback.MayForce(PP_ERROR_NOINTERFACE);
return get_interface<PPB_Flash_TCPSocket>()->Connect(
pp_resource(), host, port, callback.pp_completion_callback());
}
int32_t TCPSocket::ConnectWithNetAddress(const PP_NetAddress_Private* addr,
const CompletionCallback& callback) {
if (!has_interface<PPB_Flash_TCPSocket>())
return callback.MayForce(PP_ERROR_NOINTERFACE);
return get_interface<PPB_Flash_TCPSocket>()->ConnectWithNetAddress(
pp_resource(), addr, callback.pp_completion_callback());
}
bool TCPSocket::GetLocalAddress(PP_NetAddress_Private* local_addr) {
if (!has_interface<PPB_Flash_TCPSocket>())
return false;
PP_Bool result = get_interface<PPB_Flash_TCPSocket>()->GetLocalAddress(
pp_resource(), local_addr);
return PP_ToBool(result);
}
bool TCPSocket::GetRemoteAddress(PP_NetAddress_Private* remote_addr) {
if (!has_interface<PPB_Flash_TCPSocket>())
return false;
PP_Bool result = get_interface<PPB_Flash_TCPSocket>()->GetRemoteAddress(
pp_resource(), remote_addr);
return PP_ToBool(result);
}
int32_t TCPSocket::SSLHandshake(const char* server_name,
uint16_t server_port,
const CompletionCallback& callback) {
if (!has_interface<PPB_Flash_TCPSocket>())
return callback.MayForce(PP_ERROR_NOINTERFACE);
return get_interface<PPB_Flash_TCPSocket>()->SSLHandshake(
pp_resource(), server_name, server_port,
callback.pp_completion_callback());
}
int32_t TCPSocket::Read(char* buffer,
int32_t bytes_to_read,
const CompletionCallback& callback) {
if (!has_interface<PPB_Flash_TCPSocket>())
return callback.MayForce(PP_ERROR_NOINTERFACE);
return get_interface<PPB_Flash_TCPSocket>()->Read(
pp_resource(), buffer, bytes_to_read, callback.pp_completion_callback());
}
int32_t TCPSocket::Write(const char* buffer,
int32_t bytes_to_write,
const CompletionCallback& callback) {
if (!has_interface<PPB_Flash_TCPSocket>())
return callback.MayForce(PP_ERROR_NOINTERFACE);
return get_interface<PPB_Flash_TCPSocket>()->Write(
pp_resource(), buffer, bytes_to_write, callback.pp_completion_callback());
}
void TCPSocket::Disconnect() {
if (!has_interface<PPB_Flash_TCPSocket>())
return;
return get_interface<PPB_Flash_TCPSocket>()->Disconnect(pp_resource());
}
} // namespace flash
} // namespace pp
// Copyright (c) 2011 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.
#ifndef PPAPI_CPP_PRIVATE_FLASH_TCP_SOCKET_H_
#define PPAPI_CPP_PRIVATE_FLASH_TCP_SOCKET_H_
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/private/ppb_flash_tcp_socket.h"
#include "ppapi/cpp/resource.h"
namespace pp {
class CompletionCallback;
class Instance;
namespace flash {
class TCPSocket : public Resource {
public:
explicit TCPSocket(Instance* instance);
// Returns true if the required interface is available.
static bool IsAvailable();
int32_t Connect(const char* host,
uint16_t port,
const CompletionCallback& callback);
int32_t ConnectWithNetAddress(const PP_NetAddress_Private* addr,
const CompletionCallback& callback);
bool GetLocalAddress(PP_NetAddress_Private* local_addr);
bool GetRemoteAddress(PP_NetAddress_Private* remote_addr);
int32_t SSLHandshake(const char* server_name,
uint16_t server_port,
const CompletionCallback& callback);
int32_t Read(char* buffer,
int32_t bytes_to_read,
const CompletionCallback& callback);
int32_t Write(const char* buffer,
int32_t bytes_to_write,
const CompletionCallback& callback);
void Disconnect();
};
} // namespace flash
} // namespace pp
#endif // PPAPI_CPP_PRIVATE_FLASH_TCP_SOCKET_H_
......@@ -254,8 +254,6 @@
# Private interfaces.
'cpp/private/flash_fullscreen.cc',
'cpp/private/flash_fullscreen.h',
'cpp/private/flash_tcp_socket.cc',
'cpp/private/flash_tcp_socket.h',
'cpp/private/instance_private.cc',
'cpp/private/instance_private.h',
'cpp/private/net_address_private.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment