OLD | NEW |
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved. | 1 // Copyright (c) 2011 The Native Client 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 NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_H_ | 5 #ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_H_ |
6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_H_ | 6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_H_ |
7 | 7 |
8 #include <stdarg.h> | 8 #include <stdarg.h> |
9 | 9 |
10 #include "native_client/src/include/nacl_macros.h" | 10 #include "native_client/src/include/nacl_macros.h" |
11 #include "native_client/src/include/portability.h" | 11 #include "native_client/src/include/portability.h" |
12 #include "native_client/src/shared/srpc/nacl_srpc.h" | 12 #include "native_client/src/shared/srpc/nacl_srpc.h" |
13 #include "native_client/src/shared/platform/nacl_threads.h" | 13 #include "native_client/src/shared/platform/nacl_threads.h" |
14 #include "native_client/src/trusted/desc/nacl_desc_invalid.h" | 14 #include "native_client/src/trusted/desc/nacl_desc_invalid.h" |
15 #include "native_client/src/third_party/ppapi/c/pp_instance.h" | 15 #include "native_client/src/third_party/ppapi/c/pp_instance.h" |
16 #include "native_client/src/third_party/ppapi/c/ppp.h" | 16 #include "native_client/src/third_party/ppapi/c/ppp.h" |
17 #include "native_client/src/third_party/ppapi/c/ppp_instance.h" | 17 #include "native_client/src/third_party/ppapi/c/ppp_instance.h" |
18 #include "native_client/src/third_party/ppapi/c/ppp_messaging.h" | 18 #include "native_client/src/third_party/ppapi/c/ppp_messaging.h" |
19 | 19 |
20 namespace plugin { | 20 namespace plugin { |
21 class PluginPpapi; | 21 class PluginPpapi; |
22 } | 22 } |
23 | 23 |
| 24 struct PPP_InputEvent; |
| 25 |
24 namespace ppapi_proxy { | 26 namespace ppapi_proxy { |
25 | 27 |
26 class BrowserPpp { | 28 class BrowserPpp { |
27 public: | 29 public: |
28 BrowserPpp(NaClSrpcChannel* main_channel, | 30 BrowserPpp(NaClSrpcChannel* main_channel, |
29 plugin::PluginPpapi* plugin) | 31 plugin::PluginPpapi* plugin) |
30 : main_channel_(main_channel), plugin_pid_(0), plugin_(plugin), | 32 : main_channel_(main_channel), plugin_pid_(0), plugin_(plugin), |
31 ppp_instance_interface_(NULL), ppp_messaging_interface_(NULL) {} | 33 ppp_instance_interface_(NULL), ppp_messaging_interface_(NULL), |
| 34 ppp_input_event_interface_(NULL) {} |
32 ~BrowserPpp() {} | 35 ~BrowserPpp() {} |
33 | 36 |
34 int32_t InitializeModule(PP_Module module_id, | 37 int32_t InitializeModule(PP_Module module_id, |
35 PPB_GetInterface get_browser_interface); | 38 PPB_GetInterface get_browser_interface); |
36 void ShutdownModule(); | 39 void ShutdownModule(); |
37 // Returns an interface pointer or NULL. | 40 // Returns an interface pointer or NULL. |
38 const void* GetPluginInterface(const char* interface_name); | 41 const void* GetPluginInterface(const char* interface_name); |
39 // Returns an interface pointer or fails on a NULL CHECK. | 42 // Returns an interface pointer or fails on a NULL CHECK. |
40 const void* GetPluginInterfaceSafe(const char* interface_name); | 43 const void* GetPluginInterfaceSafe(const char* interface_name); |
41 | 44 |
42 // Guaranteed to be non-NULL if module initialization succeeded. | 45 // Guaranteed to be non-NULL if module initialization succeeded. |
43 // Use this instead of GetPluginInterface for PPP_INSTANCE_INTERFACE. | 46 // Use this instead of GetPluginInterface for PPP_INSTANCE_INTERFACE. |
44 const PPP_Instance* ppp_instance_interface() const { | 47 const PPP_Instance* ppp_instance_interface() const { |
45 return ppp_instance_interface_; | 48 return ppp_instance_interface_; |
46 } | 49 } |
47 | 50 |
48 const PPP_Messaging* ppp_messaging_interface() const { | 51 const PPP_Messaging* ppp_messaging_interface() const { |
49 return ppp_messaging_interface_; | 52 return ppp_messaging_interface_; |
50 } | 53 } |
51 | 54 |
| 55 const PPP_InputEvent* ppp_input_event_interface() const { |
| 56 return ppp_input_event_interface_; |
| 57 } |
| 58 |
52 NaClSrpcChannel* main_channel() const { return main_channel_; } | 59 NaClSrpcChannel* main_channel() const { return main_channel_; } |
53 int plugin_pid() const { return plugin_pid_; } | 60 int plugin_pid() const { return plugin_pid_; } |
54 plugin::PluginPpapi* plugin() { return plugin_; } | 61 plugin::PluginPpapi* plugin() { return plugin_; } |
55 | 62 |
56 private: | 63 private: |
57 // The "main" SRPC channel used to communicate with the plugin. | 64 // The "main" SRPC channel used to communicate with the plugin. |
58 NaClSrpcChannel* main_channel_; | 65 NaClSrpcChannel* main_channel_; |
59 // The PID of the plugin. | 66 // The PID of the plugin. |
60 int plugin_pid_; | 67 int plugin_pid_; |
61 // Plugin that owns this proxy. | 68 // Plugin that owns this proxy. |
62 plugin::PluginPpapi* plugin_; | 69 plugin::PluginPpapi* plugin_; |
63 | 70 |
64 // Set on module initialization. | 71 // Set on module initialization. |
65 const PPP_Instance* ppp_instance_interface_; | 72 const PPP_Instance* ppp_instance_interface_; |
66 const PPP_Messaging* ppp_messaging_interface_; | 73 const PPP_Messaging* ppp_messaging_interface_; |
| 74 const PPP_InputEvent* ppp_input_event_interface_; |
67 | 75 |
68 // The thread used to handle calls on other than the main thread. | 76 // The thread used to handle calls on other than the main thread. |
69 struct NaClThread upcall_thread_; | 77 struct NaClThread upcall_thread_; |
70 NACL_DISALLOW_COPY_AND_ASSIGN(BrowserPpp); | 78 NACL_DISALLOW_COPY_AND_ASSIGN(BrowserPpp); |
71 }; | 79 }; |
72 | 80 |
73 } // namespace ppapi_proxy | 81 } // namespace ppapi_proxy |
74 | 82 |
75 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_H_ | 83 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_PPP_H_ |
OLD | NEW |