[email protected] | ae971c2 | 2011-04-17 00:13:22 | [diff] [blame] | 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 | |||||
[email protected] | 0a6d5f6 | 2011-11-11 08:04:07 | [diff] [blame] | 5 | #ifndef PPAPI_PROXY_PPB_BROKER_PROXY_H_ |
6 | #define PPAPI_PROXY_PPB_BROKER_PROXY_H_ | ||||
[email protected] | ae971c2 | 2011-04-17 00:13:22 | [diff] [blame] | 7 | |
8 | #include "base/sync_socket.h" | ||||
9 | #include "ipc/ipc_platform_file.h" | ||||
10 | #include "ppapi/c/pp_instance.h" | ||||
[email protected] | ae971c2 | 2011-04-17 00:13:22 | [diff] [blame] | 11 | #include "ppapi/proxy/interface_proxy.h" |
[email protected] | 47a961c | 2012-07-13 19:18:52 | [diff] [blame] | 12 | #include "ppapi/proxy/proxy_completion_callback_factory.h" |
[email protected] | ae5ff9ae | 2012-01-06 22:50:33 | [diff] [blame] | 13 | #include "ppapi/utility/completion_callback_factory.h" |
[email protected] | ae971c2 | 2011-04-17 00:13:22 | [diff] [blame] | 14 | |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 15 | namespace ppapi { |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 16 | |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 17 | class HostResource; |
18 | |||||
[email protected] | ae971c2 | 2011-04-17 00:13:22 | [diff] [blame] | 19 | namespace proxy { |
20 | |||||
[email protected] | ae971c2 | 2011-04-17 00:13:22 | [diff] [blame] | 21 | class PPB_Broker_Proxy : public InterfaceProxy { |
22 | public: | ||||
[email protected] | 0a6d5f6 | 2011-11-11 08:04:07 | [diff] [blame] | 23 | explicit PPB_Broker_Proxy(Dispatcher* dispatcher); |
[email protected] | ae971c2 | 2011-04-17 00:13:22 | [diff] [blame] | 24 | virtual ~PPB_Broker_Proxy(); |
25 | |||||
[email protected] | 9815108e | 2011-05-27 21:50:28 | [diff] [blame] | 26 | static PP_Resource CreateProxyResource(PP_Instance instance); |
27 | |||||
[email protected] | ae971c2 | 2011-04-17 00:13:22 | [diff] [blame] | 28 | // InterfaceProxy implementation. |
29 | virtual bool OnMessageReceived(const IPC::Message& msg); | ||||
30 | |||||
[email protected] | ac4b54d | 2011-10-20 23:09:28 | [diff] [blame] | 31 | static const ApiID kApiID = API_ID_PPB_BROKER; |
[email protected] | 5c96602 | 2011-09-13 18:09:37 | [diff] [blame] | 32 | |
[email protected] | ae971c2 | 2011-04-17 00:13:22 | [diff] [blame] | 33 | private: |
34 | // Message handlers. | ||||
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 35 | void OnMsgCreate(PP_Instance instance, ppapi::HostResource* result_resource); |
36 | void OnMsgConnect(const ppapi::HostResource& broker); | ||||
37 | void OnMsgConnectComplete(const ppapi::HostResource& broker, | ||||
[email protected] | ae971c2 | 2011-04-17 00:13:22 | [diff] [blame] | 38 | IPC::PlatformFileForTransit foreign_socket_handle, |
39 | int32_t result); | ||||
40 | |||||
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 41 | void ConnectCompleteInHost(int32_t result, |
42 | const ppapi::HostResource& host_resource); | ||||
[email protected] | ae971c2 | 2011-04-17 00:13:22 | [diff] [blame] | 43 | |
[email protected] | 47a961c | 2012-07-13 19:18:52 | [diff] [blame] | 44 | ProxyCompletionCallbackFactory<PPB_Broker_Proxy> callback_factory_; |
[email protected] | ae971c2 | 2011-04-17 00:13:22 | [diff] [blame] | 45 | }; |
46 | |||||
47 | } // namespace proxy | ||||
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 48 | } // namespace ppapi |
[email protected] | ae971c2 | 2011-04-17 00:13:22 | [diff] [blame] | 49 | |
[email protected] | 0a6d5f6 | 2011-11-11 08:04:07 | [diff] [blame] | 50 | #endif // PPAPI_PROXY_PPB_BROKER_PROXY_H_ |