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