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 // Implements the untrusted side of the PPB_GetInterface method. | 5 // Implements the untrusted side of the PPB_GetInterface method. |
6 | 6 |
7 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" | 7 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include "native_client/src/shared/ppapi_proxy/plugin_context_3d.h" | 10 #include "native_client/src/shared/ppapi_proxy/plugin_context_3d.h" |
11 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_audio.h" | 11 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_audio.h" |
12 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.h" | 12 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_audio_config.h" |
13 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_buffer.h" | 13 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_buffer.h" |
14 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_core.h" | 14 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_core.h" |
15 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.h" | 15 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_cursor_control.h" |
16 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.h" | 16 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_file_io.h" |
17 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.h" | 17 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_file_system.h" |
18 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_find.h" | 18 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_find.h" |
19 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_font.h" | 19 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_font.h" |
20 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.h" | 20 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.h" |
21 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.h" | 21 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.h" |
| 22 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h" |
22 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_instance.h" | 23 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_instance.h" |
23 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_memory.h" | 24 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_memory.h" |
24 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.h" | 25 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.h" |
25 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_pdf.h" | 26 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_pdf.h" |
26 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_scrollbar.h" | 27 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_scrollbar.h" |
27 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_testing.h" | 28 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_testing.h" |
28 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.h" | 29 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.h" |
29 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.h" | 30 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.h" |
30 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.h" | 31 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.h" |
31 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h" | 32 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h" |
32 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_widget.h" | 33 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_widget.h" |
33 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_zoom.h" | 34 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_zoom.h" |
34 #include "native_client/src/shared/ppapi_proxy/plugin_surface_3d.h" | 35 #include "native_client/src/shared/ppapi_proxy/plugin_surface_3d.h" |
| 36 #include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h" |
35 #include "native_client/src/shared/ppapi_proxy/utility.h" | 37 #include "native_client/src/shared/ppapi_proxy/utility.h" |
36 #include "srpcgen/ppb_rpc.h" | |
37 | 38 |
38 namespace ppapi_proxy { | 39 namespace ppapi_proxy { |
39 | 40 |
40 namespace { | 41 namespace { |
41 | 42 |
42 struct InterfaceMapElement { | 43 struct InterfaceMapElement { |
43 const char* name; | 44 const char* name; |
44 const void* ppb_interface; | 45 const void* ppb_interface; |
45 bool needs_browser_check; | 46 bool needs_browser_check; |
46 }; | 47 }; |
47 | 48 |
48 // List of interfaces that have at least partial proxy support. | 49 // List of interfaces that have at least partial proxy support. |
49 InterfaceMapElement interface_map[] = { | 50 InterfaceMapElement interface_map[] = { |
50 { PPB_AUDIO_INTERFACE, PluginAudio::GetInterface(), true }, | 51 { PPB_AUDIO_INTERFACE, PluginAudio::GetInterface(), true }, |
51 { PPB_AUDIO_CONFIG_INTERFACE, PluginAudioConfig::GetInterface(), true }, | 52 { PPB_AUDIO_CONFIG_INTERFACE, PluginAudioConfig::GetInterface(), true }, |
52 { PPB_CORE_INTERFACE, PluginCore::GetInterface(), true }, | 53 { PPB_CORE_INTERFACE, PluginCore::GetInterface(), true }, |
53 { PPB_CURSOR_CONTROL_DEV_INTERFACE, PluginCursorControl::GetInterface(), | 54 { PPB_CURSOR_CONTROL_DEV_INTERFACE, PluginCursorControl::GetInterface(), |
54 true }, | 55 true }, |
55 { PPB_CONTEXT_3D_DEV_INTERFACE, PluginContext3D::GetInterface(), true }, | 56 { PPB_CONTEXT_3D_DEV_INTERFACE, PluginContext3D::GetInterface(), true }, |
56 { PPB_FILEIO_INTERFACE, PluginFileIO::GetInterface(), true }, | 57 { PPB_FILEIO_INTERFACE, PluginFileIO::GetInterface(), true }, |
57 { PPB_FILESYSTEM_INTERFACE, PluginFileSystem::GetInterface(), true }, | 58 { PPB_FILESYSTEM_INTERFACE, PluginFileSystem::GetInterface(), true }, |
58 { PPB_FIND_DEV_INTERFACE, PluginFind::GetInterface(), true }, | 59 { PPB_FIND_DEV_INTERFACE, PluginFind::GetInterface(), true }, |
59 { PPB_FONT_DEV_INTERFACE, PluginFont::GetInterface(), true }, | 60 { PPB_FONT_DEV_INTERFACE, PluginFont::GetInterface(), true }, |
60 { PPB_GRAPHICS_2D_INTERFACE, PluginGraphics2D::GetInterface(), true }, | 61 { PPB_GRAPHICS_2D_INTERFACE, PluginGraphics2D::GetInterface(), true }, |
61 { PPB_IMAGEDATA_INTERFACE, PluginImageData::GetInterface(), true }, | 62 { PPB_IMAGEDATA_INTERFACE, PluginImageData::GetInterface(), true }, |
| 63 { PPB_INPUT_EVENT_INTERFACE, PluginInputEvent::GetInterface(), true }, |
62 { PPB_INSTANCE_INTERFACE, PluginInstance::GetInterface(), true }, | 64 { PPB_INSTANCE_INTERFACE, PluginInstance::GetInterface(), true }, |
| 65 { PPB_KEYBOARD_INPUT_EVENT_INTERFACE, |
| 66 PluginInputEvent::GetKeyboardInterface(), true }, |
63 { PPB_MEMORY_DEV_INTERFACE, PluginMemory::GetInterface(), true }, | 67 { PPB_MEMORY_DEV_INTERFACE, PluginMemory::GetInterface(), true }, |
64 { PPB_MESSAGING_INTERFACE, PluginMessaging::GetInterface(), true }, | 68 { PPB_MESSAGING_INTERFACE, PluginMessaging::GetInterface(), true }, |
| 69 { PPB_MOUSE_INPUT_EVENT_INTERFACE, PluginInputEvent::GetMouseInterface(), |
| 70 true }, |
65 { PPB_OPENGLES2_DEV_INTERFACE, PluginContext3D::GetOpenGLESInterface(), | 71 { PPB_OPENGLES2_DEV_INTERFACE, PluginContext3D::GetOpenGLESInterface(), |
66 true }, | 72 true }, |
67 { PPB_PDF_INTERFACE, PluginPDF::GetInterface(), true }, | 73 { PPB_PDF_INTERFACE, PluginPDF::GetInterface(), true }, |
68 { PPB_SCROLLBAR_DEV_INTERFACE, PluginScrollbar::GetInterface(), true }, | 74 { PPB_SCROLLBAR_DEV_INTERFACE, PluginScrollbar::GetInterface(), true }, |
69 { PPB_SURFACE_3D_DEV_INTERFACE, PluginSurface3D::GetInterface(), true }, | 75 { PPB_SURFACE_3D_DEV_INTERFACE, PluginSurface3D::GetInterface(), true }, |
70 { PPB_TESTING_DEV_INTERFACE, PluginTesting::GetInterface(), true }, | 76 { PPB_TESTING_DEV_INTERFACE, PluginTesting::GetInterface(), true }, |
71 { PPB_URLLOADER_INTERFACE, PluginURLLoader::GetInterface(), true }, | 77 { PPB_URLLOADER_INTERFACE, PluginURLLoader::GetInterface(), true }, |
72 { PPB_URLREQUESTINFO_INTERFACE, PluginURLRequestInfo::GetInterface(), true }, | 78 { PPB_URLREQUESTINFO_INTERFACE, PluginURLRequestInfo::GetInterface(), true }, |
73 { PPB_URLRESPONSEINFO_INTERFACE, PluginURLResponseInfo::GetInterface(), | 79 { PPB_URLRESPONSEINFO_INTERFACE, PluginURLResponseInfo::GetInterface(), |
74 true }, | 80 true }, |
75 { PPB_VAR_INTERFACE, PluginVar::GetInterface(), true }, | 81 { PPB_VAR_INTERFACE, PluginVar::GetInterface(), true }, |
| 82 { PPB_WHEEL_INPUT_EVENT_INTERFACE, PluginInputEvent::GetWheelInterface(), |
| 83 true }, |
76 { PPB_WIDGET_DEV_INTERFACE, PluginWidget::GetInterface(), true }, | 84 { PPB_WIDGET_DEV_INTERFACE, PluginWidget::GetInterface(), true }, |
77 { PPB_ZOOM_DEV_INTERFACE, PluginZoom::GetInterface(), true }, | 85 { PPB_ZOOM_DEV_INTERFACE, PluginZoom::GetInterface(), true }, |
78 }; | 86 }; |
79 | 87 |
80 } // namespace | 88 } // namespace |
81 | 89 |
82 // Returns the pointer to the interface proxy or NULL if not yet supported. | 90 // Returns the pointer to the interface proxy or NULL if not yet supported. |
83 // On the first invocation for a given interface that has proxy support, | 91 // On the first invocation for a given interface that has proxy support, |
84 // also confirms over RPC that the browser indeed exports this interface. | 92 // also confirms over RPC that the browser indeed exports this interface. |
85 // Returns NULL otherwise. | 93 // Returns NULL otherwise. |
(...skipping 26 matching lines...) Expand all Loading... |
112 interface_name, NaClSrpcErrorString(srpc_result)); | 120 interface_name, NaClSrpcErrorString(srpc_result)); |
113 if (srpc_result != NACL_SRPC_RESULT_OK || !browser_exports_interface) { | 121 if (srpc_result != NACL_SRPC_RESULT_OK || !browser_exports_interface) { |
114 interface_map[index].ppb_interface = NULL; | 122 interface_map[index].ppb_interface = NULL; |
115 ppb_interface = NULL; | 123 ppb_interface = NULL; |
116 } | 124 } |
117 interface_map[index].needs_browser_check = false; | 125 interface_map[index].needs_browser_check = false; |
118 return ppb_interface; | 126 return ppb_interface; |
119 } | 127 } |
120 | 128 |
121 } // namespace ppapi_proxy | 129 } // namespace ppapi_proxy |
OLD | NEW |