OLD | NEW |
| (Empty) |
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_FLASH_NET_CONNECTOR_PROXY_H_ | |
6 #define PPAPI_PROXY_PPB_FLASH_NET_CONNECTOR_PROXY_H_ | |
7 | |
8 #include "base/platform_file.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_non_thread_safe_ref_count.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_Flash_NetConnector_Proxy : public InterfaceProxy { | |
22 public: | |
23 PPB_Flash_NetConnector_Proxy(Dispatcher* dispatcher); | |
24 virtual ~PPB_Flash_NetConnector_Proxy(); | |
25 | |
26 static PP_Resource CreateProxyResource(PP_Instance instance); | |
27 | |
28 // InterfaceProxy implementation. | |
29 virtual bool OnMessageReceived(const IPC::Message& msg); | |
30 | |
31 private: | |
32 struct ConnectCallbackInfo; | |
33 | |
34 // Plugin->host message handlers. | |
35 void OnMsgCreate(PP_Instance instance, | |
36 ppapi::HostResource* result); | |
37 void OnMsgConnectTcp(const ppapi::HostResource& resource, | |
38 const std::string& host, | |
39 uint16_t port); | |
40 void OnMsgConnectTcpAddress(const ppapi::HostResource& resource_id, | |
41 const std::string& net_address_as_string); | |
42 | |
43 // Host->plugin message handler. | |
44 void OnMsgConnectACK(const ppapi::HostResource& host_resource, | |
45 int32_t result, | |
46 IPC::PlatformFileForTransit handle, | |
47 const std::string& load_addr_as_string, | |
48 const std::string& remote_addr_as_string); | |
49 | |
50 void OnCompleteCallbackInHost(int32_t result, ConnectCallbackInfo* info); | |
51 | |
52 pp::CompletionCallbackFactory<PPB_Flash_NetConnector_Proxy, | |
53 ProxyNonThreadSafeRefCount> callback_factory_; | |
54 }; | |
55 | |
56 } // namespace proxy | |
57 } // namespace ppapi | |
58 | |
59 #endif // PPAPI_PROXY_PPB_FLASH_NET_CONNECTOR_PROXY_H_ | |
OLD | NEW |