Home | History | Annotate | Download | only in proxy
      1 // Copyright (c) 2012 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_PPB_TCP_SOCKET_PRIVATE_PROXY_H_
      6 #define PPAPI_PROXY_PPB_TCP_SOCKET_PRIVATE_PROXY_H_
      7 
      8 #include <string>
      9 
     10 #include "base/basictypes.h"
     11 #include "ppapi/c/pp_instance.h"
     12 #include "ppapi/c/pp_resource.h"
     13 #include "ppapi/c/private/ppb_tcp_socket_private.h"
     14 #include "ppapi/proxy/interface_proxy.h"
     15 #include "ppapi/proxy/ppapi_proxy_export.h"
     16 
     17 namespace ppapi {
     18 
     19 class PPB_X509Certificate_Fields;
     20 
     21 namespace proxy {
     22 
     23 class PPB_TCPSocket_Private_Proxy : public InterfaceProxy {
     24  public:
     25   explicit PPB_TCPSocket_Private_Proxy(Dispatcher* dispatcher);
     26   virtual ~PPB_TCPSocket_Private_Proxy();
     27 
     28   static PP_Resource CreateProxyResource(PP_Instance instance);
     29   static PP_Resource CreateProxyResourceForConnectedSocket(
     30       PP_Instance instance,
     31       uint32 socket_id,
     32       const PP_NetAddress_Private& local_addr,
     33       const PP_NetAddress_Private& remote_addr);
     34 
     35   // InterfaceProxy implementation.
     36   virtual bool OnMessageReceived(const IPC::Message& msg);
     37 
     38   static const ApiID kApiID = API_ID_PPB_TCPSOCKET_PRIVATE;
     39 
     40  private:
     41   // Browser->plugin message handlers.
     42   void OnMsgConnectACK(uint32 plugin_dispatcher_id,
     43                        uint32 socket_id,
     44                        int32_t result,
     45                        const PP_NetAddress_Private& local_addr,
     46                        const PP_NetAddress_Private& remote_addr);
     47   void OnMsgSSLHandshakeACK(
     48       uint32 plugin_dispatcher_id,
     49       uint32 socket_id,
     50       bool succeeded,
     51       const PPB_X509Certificate_Fields& certificate_fields);
     52   void OnMsgReadACK(uint32 plugin_dispatcher_id,
     53                     uint32 socket_id,
     54                     int32_t result,
     55                     const std::string& data);
     56   void OnMsgWriteACK(uint32 plugin_dispatcher_id,
     57                      uint32 socket_id,
     58                      int32_t result);
     59   void OnMsgSetOptionACK(uint32 plugin_dispatcher_id,
     60                          uint32 socket_id,
     61                          int32_t result);
     62 
     63   DISALLOW_COPY_AND_ASSIGN(PPB_TCPSocket_Private_Proxy);
     64 };
     65 
     66 }  // namespace proxy
     67 }  // namespace ppapi
     68 
     69 #endif  // PPAPI_PROXY_PPB_TCP_SOCKET_PRIVATE_PROXY_H_
     70