| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // TODO(yzshen): See the comment in corresponding .h file. | 5 // TODO(yzshen): See the comment in corresponding .h file. |
| 6 | 6 |
| 7 #include "ppapi/cpp/private/flash_tcp_socket.h" | 7 #include "ppapi/cpp/private/flash_tcp_socket.h" |
| 8 | 8 |
| 9 #include "ppapi/c/pp_bool.h" | 9 #include "ppapi/c/pp_bool.h" |
| 10 #include "ppapi/c/pp_errors.h" | 10 #include "ppapi/c/pp_errors.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 int32_t TCPSocket::Connect(const char* host, | 35 int32_t TCPSocket::Connect(const char* host, |
| 36 uint16_t port, | 36 uint16_t port, |
| 37 const CompletionCallback& callback) { | 37 const CompletionCallback& callback) { |
| 38 if (!has_interface<PPB_Flash_TCPSocket>()) | 38 if (!has_interface<PPB_Flash_TCPSocket>()) |
| 39 return callback.MayForce(PP_ERROR_NOINTERFACE); | 39 return callback.MayForce(PP_ERROR_NOINTERFACE); |
| 40 return get_interface<PPB_Flash_TCPSocket>()->Connect( | 40 return get_interface<PPB_Flash_TCPSocket>()->Connect( |
| 41 pp_resource(), host, port, callback.pp_completion_callback()); | 41 pp_resource(), host, port, callback.pp_completion_callback()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 int32_t TCPSocket::ConnectWithNetAddress(const PP_Flash_NetAddress* addr, | 44 int32_t TCPSocket::ConnectWithNetAddress(const PP_NetAddress_Private* addr, |
| 45 const CompletionCallback& callback) { | 45 const CompletionCallback& callback) { |
| 46 if (!has_interface<PPB_Flash_TCPSocket>()) | 46 if (!has_interface<PPB_Flash_TCPSocket>()) |
| 47 return callback.MayForce(PP_ERROR_NOINTERFACE); | 47 return callback.MayForce(PP_ERROR_NOINTERFACE); |
| 48 return get_interface<PPB_Flash_TCPSocket>()->ConnectWithNetAddress( | 48 return get_interface<PPB_Flash_TCPSocket>()->ConnectWithNetAddress( |
| 49 pp_resource(), addr, callback.pp_completion_callback()); | 49 pp_resource(), addr, callback.pp_completion_callback()); |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool TCPSocket::GetLocalAddress(PP_Flash_NetAddress* local_addr) { | 52 bool TCPSocket::GetLocalAddress(PP_NetAddress_Private* local_addr) { |
| 53 if (!has_interface<PPB_Flash_TCPSocket>()) | 53 if (!has_interface<PPB_Flash_TCPSocket>()) |
| 54 return false; | 54 return false; |
| 55 | 55 |
| 56 PP_Bool result = get_interface<PPB_Flash_TCPSocket>()->GetLocalAddress( | 56 PP_Bool result = get_interface<PPB_Flash_TCPSocket>()->GetLocalAddress( |
| 57 pp_resource(), local_addr); | 57 pp_resource(), local_addr); |
| 58 return PP_ToBool(result); | 58 return PP_ToBool(result); |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool TCPSocket::GetRemoteAddress(PP_Flash_NetAddress* remote_addr) { | 61 bool TCPSocket::GetRemoteAddress(PP_NetAddress_Private* remote_addr) { |
| 62 if (!has_interface<PPB_Flash_TCPSocket>()) | 62 if (!has_interface<PPB_Flash_TCPSocket>()) |
| 63 return false; | 63 return false; |
| 64 PP_Bool result = get_interface<PPB_Flash_TCPSocket>()->GetRemoteAddress( | 64 PP_Bool result = get_interface<PPB_Flash_TCPSocket>()->GetRemoteAddress( |
| 65 pp_resource(), remote_addr); | 65 pp_resource(), remote_addr); |
| 66 return PP_ToBool(result); | 66 return PP_ToBool(result); |
| 67 } | 67 } |
| 68 | 68 |
| 69 int32_t TCPSocket::SSLHandshake(const char* server_name, | 69 int32_t TCPSocket::SSLHandshake(const char* server_name, |
| 70 uint16_t server_port, | 70 uint16_t server_port, |
| 71 const CompletionCallback& callback) { | 71 const CompletionCallback& callback) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 95 } | 95 } |
| 96 | 96 |
| 97 void TCPSocket::Disconnect() { | 97 void TCPSocket::Disconnect() { |
| 98 if (!has_interface<PPB_Flash_TCPSocket>()) | 98 if (!has_interface<PPB_Flash_TCPSocket>()) |
| 99 return; | 99 return; |
| 100 return get_interface<PPB_Flash_TCPSocket>()->Disconnect(pp_resource()); | 100 return get_interface<PPB_Flash_TCPSocket>()->Disconnect(pp_resource()); |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace flash | 103 } // namespace flash |
| 104 } // namespace pp | 104 } // namespace pp |
| OLD | NEW |