Home | History | Annotate | Download | only in proxy
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef PPAPI_PROXY_PPB_BROKER_PROXY_H_
      6 #define PPAPI_PROXY_PPB_BROKER_PROXY_H_
      7 
      8 #include "base/sync_socket.h"
      9 #include "ipc/ipc_platform_file.h"
     10 #include "ppapi/c/pp_instance.h"
     11 #include "ppapi/proxy/interface_proxy.h"
     12 #include "ppapi/proxy/proxy_completion_callback_factory.h"
     13 #include "ppapi/utility/completion_callback_factory.h"
     14 
     15 namespace ppapi {
     16 
     17 class HostResource;
     18 
     19 namespace proxy {
     20 
     21 class PPB_Broker_Proxy : public InterfaceProxy {
     22  public:
     23   explicit PPB_Broker_Proxy(Dispatcher* dispatcher);
     24   virtual ~PPB_Broker_Proxy();
     25 
     26   static PP_Resource CreateProxyResource(PP_Instance instance);
     27 
     28   // InterfaceProxy implementation.
     29   virtual bool OnMessageReceived(const IPC::Message& msg);
     30 
     31   static const ApiID kApiID = API_ID_PPB_BROKER;
     32 
     33  private:
     34   // Message handlers.
     35   void OnMsgCreate(PP_Instance instance, ppapi::HostResource* result_resource);
     36   void OnMsgConnect(const ppapi::HostResource& broker);
     37   void OnMsgConnectComplete(const ppapi::HostResource& broker,
     38                             IPC::PlatformFileForTransit foreign_socket_handle,
     39                             int32_t result);
     40 
     41   void ConnectCompleteInHost(int32_t result,
     42                              const ppapi::HostResource& host_resource);
     43 
     44   ProxyCompletionCallbackFactory<PPB_Broker_Proxy> callback_factory_;
     45 };
     46 
     47 }  // namespace proxy
     48 }  // namespace ppapi
     49 
     50 #endif  // PPAPI_PROXY_PPB_BROKER_PROXY_H_
     51