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