tcp_socket_resource.h revision 424c4d7b64af9d0d8fd9624f381f469654d5e3d2
1// Copyright 2013 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_ 6#define PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_ 7 8#include "base/basictypes.h" 9#include "base/compiler_specific.h" 10#include "ppapi/proxy/tcp_socket_resource_base.h" 11#include "ppapi/thunk/ppb_tcp_socket_api.h" 12 13namespace ppapi { 14namespace proxy { 15 16class PPAPI_PROXY_EXPORT TCPSocketResource : public thunk::PPB_TCPSocket_API, 17 public TCPSocketResourceBase { 18 public: 19 TCPSocketResource(Connection connection, PP_Instance instance); 20 virtual ~TCPSocketResource(); 21 22 // PluginResource overrides. 23 virtual thunk::PPB_TCPSocket_API* AsPPB_TCPSocket_API() OVERRIDE; 24 25 // thunk::PPB_TCPSocket_API implementation. 26 virtual int32_t Connect(PP_Resource addr, 27 scoped_refptr<TrackedCallback> callback) OVERRIDE; 28 virtual PP_Resource GetLocalAddress() OVERRIDE; 29 virtual PP_Resource GetRemoteAddress() OVERRIDE; 30 virtual int32_t Read(char* buffer, 31 int32_t bytes_to_read, 32 scoped_refptr<TrackedCallback> callback) OVERRIDE; 33 virtual int32_t Write(const char* buffer, 34 int32_t bytes_to_write, 35 scoped_refptr<TrackedCallback> callback) OVERRIDE; 36 virtual void Close() OVERRIDE; 37 virtual int32_t SetOption(PP_TCPSocket_Option name, 38 const PP_Var& value, 39 scoped_refptr<TrackedCallback> callback) OVERRIDE; 40 41 private: 42 DISALLOW_COPY_AND_ASSIGN(TCPSocketResource); 43}; 44 45} // namespace proxy 46} // namespace ppapi 47 48#endif // PPAPI_PROXY_TCP_SOCKET_RESOURCE_H_ 49