Chromium Code Reviews| Index: ppapi/cpp/private/tcp_socket.cc |
| diff --git a/ppapi/cpp/private/flash_tcp_socket.cc b/ppapi/cpp/private/tcp_socket.cc |
| similarity index 60% |
| rename from ppapi/cpp/private/flash_tcp_socket.cc |
| rename to ppapi/cpp/private/tcp_socket.cc |
| index 98e9906a44bb4072a9a1a52a48fa406e794aac40..97ecbb977e6c00c67ad9fd626ad5ef835c9b3298 100644 |
| --- a/ppapi/cpp/private/flash_tcp_socket.cc |
| +++ b/ppapi/cpp/private/tcp_socket.cc |
| @@ -4,7 +4,7 @@ |
| // TODO(yzshen): See the comment in corresponding .h file. |
|
yzshen1
2011/11/09 23:53:55
If you remove the TODO in the .h file, please remo
Dmitry Polukhin
2011/11/10 15:10:11
Done.
|
| -#include "ppapi/cpp/private/flash_tcp_socket.h" |
| +#include "ppapi/cpp/private/tcp_socket.h" |
| #include "ppapi/c/pp_bool.h" |
| #include "ppapi/c/pp_errors.h" |
| @@ -17,17 +17,15 @@ namespace pp { |
| namespace { |
| -template <> const char* interface_name<PPB_Flash_TCPSocket>() { |
| - return PPB_FLASH_TCPSOCKET_INTERFACE; |
| +template <> const char* interface_name<PPB_TCPSocket>() { |
| + return PPB_TCPSOCKET_INTERFACE; |
| } |
| } // namespace |
| -namespace flash { |
| - |
| TCPSocket::TCPSocket(Instance* instance) { |
| - if (has_interface<PPB_Flash_TCPSocket>() && instance) { |
| - PassRefFromConstructor(get_interface<PPB_Flash_TCPSocket>()->Create( |
| + if (has_interface<PPB_TCPSocket>() && instance) { |
| + PassRefFromConstructor(get_interface<PPB_TCPSocket>()->Create( |
| instance->pp_instance())); |
| } |
| } |
| @@ -35,33 +33,33 @@ TCPSocket::TCPSocket(Instance* instance) { |
| int32_t TCPSocket::Connect(const char* host, |
| uint16_t port, |
| const CompletionCallback& callback) { |
| - if (!has_interface<PPB_Flash_TCPSocket>()) |
| + if (!has_interface<PPB_TCPSocket>()) |
| return callback.MayForce(PP_ERROR_NOINTERFACE); |
| - return get_interface<PPB_Flash_TCPSocket>()->Connect( |
| + return get_interface<PPB_TCPSocket>()->Connect( |
| pp_resource(), host, port, callback.pp_completion_callback()); |
| } |
| -int32_t TCPSocket::ConnectWithNetAddress(const PP_Flash_NetAddress* addr, |
| +int32_t TCPSocket::ConnectWithNetAddress(const PP_NetAddress* addr, |
| const CompletionCallback& callback) { |
| - if (!has_interface<PPB_Flash_TCPSocket>()) |
| + if (!has_interface<PPB_TCPSocket>()) |
| return callback.MayForce(PP_ERROR_NOINTERFACE); |
| - return get_interface<PPB_Flash_TCPSocket>()->ConnectWithNetAddress( |
| + return get_interface<PPB_TCPSocket>()->ConnectWithNetAddress( |
| pp_resource(), addr, callback.pp_completion_callback()); |
| } |
| -bool TCPSocket::GetLocalAddress(PP_Flash_NetAddress* local_addr) { |
| - if (!has_interface<PPB_Flash_TCPSocket>()) |
| +bool TCPSocket::GetLocalAddress(PP_NetAddress* local_addr) { |
| + if (!has_interface<PPB_TCPSocket>()) |
| return false; |
| - PP_Bool result = get_interface<PPB_Flash_TCPSocket>()->GetLocalAddress( |
| + PP_Bool result = get_interface<PPB_TCPSocket>()->GetLocalAddress( |
| pp_resource(), local_addr); |
| return PP_ToBool(result); |
| } |
| -bool TCPSocket::GetRemoteAddress(PP_Flash_NetAddress* remote_addr) { |
| - if (!has_interface<PPB_Flash_TCPSocket>()) |
| +bool TCPSocket::GetRemoteAddress(PP_NetAddress* remote_addr) { |
| + if (!has_interface<PPB_TCPSocket>()) |
| return false; |
| - PP_Bool result = get_interface<PPB_Flash_TCPSocket>()->GetRemoteAddress( |
| + PP_Bool result = get_interface<PPB_TCPSocket>()->GetRemoteAddress( |
| pp_resource(), remote_addr); |
| return PP_ToBool(result); |
| } |
| @@ -69,9 +67,9 @@ bool TCPSocket::GetRemoteAddress(PP_Flash_NetAddress* remote_addr) { |
| int32_t TCPSocket::SSLHandshake(const char* server_name, |
| uint16_t server_port, |
| const CompletionCallback& callback) { |
| - if (!has_interface<PPB_Flash_TCPSocket>()) |
| + if (!has_interface<PPB_TCPSocket>()) |
| return callback.MayForce(PP_ERROR_NOINTERFACE); |
| - return get_interface<PPB_Flash_TCPSocket>()->SSLHandshake( |
| + return get_interface<PPB_TCPSocket>()->SSLHandshake( |
| pp_resource(), server_name, server_port, |
| callback.pp_completion_callback()); |
| } |
| @@ -79,26 +77,25 @@ int32_t TCPSocket::SSLHandshake(const char* server_name, |
| int32_t TCPSocket::Read(char* buffer, |
| int32_t bytes_to_read, |
| const CompletionCallback& callback) { |
| - if (!has_interface<PPB_Flash_TCPSocket>()) |
| + if (!has_interface<PPB_TCPSocket>()) |
| return callback.MayForce(PP_ERROR_NOINTERFACE); |
| - return get_interface<PPB_Flash_TCPSocket>()->Read( |
| + return get_interface<PPB_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>()) |
| + if (!has_interface<PPB_TCPSocket>()) |
| return callback.MayForce(PP_ERROR_NOINTERFACE); |
| - return get_interface<PPB_Flash_TCPSocket>()->Write( |
| + return get_interface<PPB_TCPSocket>()->Write( |
| pp_resource(), buffer, bytes_to_write, callback.pp_completion_callback()); |
| } |
| void TCPSocket::Disconnect() { |
| - if (!has_interface<PPB_Flash_TCPSocket>()) |
| + if (!has_interface<PPB_TCPSocket>()) |
| return; |
| - return get_interface<PPB_Flash_TCPSocket>()->Disconnect(pp_resource()); |
| + return get_interface<PPB_TCPSocket>()->Disconnect(pp_resource()); |
| } |
| -} // namespace flash |
| } // namespace pp |