| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_ppb_audio.h" | 10 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_audio.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.h" | 24 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.h" |
| 25 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h" | 25 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_input_event.h" |
| 26 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_instance.h" | 26 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_instance.h" |
| 27 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_memory.h" | 27 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_memory.h" |
| 28 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.h" | 28 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_messaging.h" |
| 29 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.h" | 29 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_cursor.h" |
| 30 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.h" | 30 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_mouse_lock.h" |
| 31 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_net_address_private.h" | 31 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_net_address_private.h" |
| 32 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_network_list_private.h
" | 32 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_network_list_private.h
" |
| 33 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_network_monitor_privat
e.h" | 33 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_network_monitor_privat
e.h" |
| 34 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_pdf.h" | |
| 35 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_scrollbar.h" | |
| 36 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_server_socket_priv
ate.h" | 34 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_server_socket_priv
ate.h" |
| 37 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_socket_private.h" | 35 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_tcp_socket_private.h" |
| 38 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_testing.h" | 36 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_testing.h" |
| 39 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_udp_socket_private.h" | 37 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_udp_socket_private.h" |
| 40 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.h" | 38 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.h" |
| 41 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.h" | 39 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.h" |
| 42 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.h" | 40 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.h" |
| 43 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h" | 41 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h" |
| 44 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_view.h" | 42 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_view.h" |
| 45 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_websocket.h" | 43 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_websocket.h" |
| 46 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_widget.h" | |
| 47 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_zoom.h" | 44 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_zoom.h" |
| 48 #include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h" | 45 #include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppb_rpc.h" |
| 49 #include "native_client/src/shared/ppapi_proxy/utility.h" | 46 #include "native_client/src/shared/ppapi_proxy/utility.h" |
| 50 | 47 |
| 51 namespace ppapi_proxy { | 48 namespace ppapi_proxy { |
| 52 | 49 |
| 53 namespace { | 50 namespace { |
| 54 | 51 |
| 55 struct InterfaceMapElement { | 52 struct InterfaceMapElement { |
| 56 const char* name; | 53 const char* name; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 true }, | 112 true }, |
| 116 { PPB_OPENGLES2_CHROMIUMENABLEFEATURE_INTERFACE_1_0, | 113 { PPB_OPENGLES2_CHROMIUMENABLEFEATURE_INTERFACE_1_0, |
| 117 PluginGraphics3D::GetOpenGLESChromiumEnableFeatureInterface(), | 114 PluginGraphics3D::GetOpenGLESChromiumEnableFeatureInterface(), |
| 118 true }, | 115 true }, |
| 119 { PPB_OPENGLES2_CHROMIUMMAPSUB_INTERFACE_1_0, | 116 { PPB_OPENGLES2_CHROMIUMMAPSUB_INTERFACE_1_0, |
| 120 PluginGraphics3D::GetOpenGLESChromiumMapSubInterface(), | 117 PluginGraphics3D::GetOpenGLESChromiumMapSubInterface(), |
| 121 true }, | 118 true }, |
| 122 { PPB_OPENGLES2_QUERY_INTERFACE_1_0, | 119 { PPB_OPENGLES2_QUERY_INTERFACE_1_0, |
| 123 PluginGraphics3D::GetOpenGLESQueryInterface(), | 120 PluginGraphics3D::GetOpenGLESQueryInterface(), |
| 124 true }, | 121 true }, |
| 125 { PPB_PDF_INTERFACE, PluginPDF::GetInterface(), true }, | |
| 126 { PPB_SCROLLBAR_DEV_INTERFACE, PluginScrollbar::GetInterface(), true }, | |
| 127 { PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE, | 122 { PPB_TCPSERVERSOCKET_PRIVATE_INTERFACE, |
| 128 PluginTCPServerSocketPrivate::GetInterface(), | 123 PluginTCPServerSocketPrivate::GetInterface(), |
| 129 true }, | 124 true }, |
| 130 { PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4, | 125 { PPB_TCPSOCKET_PRIVATE_INTERFACE_0_4, |
| 131 PluginTCPSocketPrivate::GetInterface0_4(), true }, | 126 PluginTCPSocketPrivate::GetInterface0_4(), true }, |
| 132 { PPB_TCPSOCKET_PRIVATE_INTERFACE_0_3, | 127 { PPB_TCPSOCKET_PRIVATE_INTERFACE_0_3, |
| 133 PluginTCPSocketPrivate::GetInterface0_3(), true }, | 128 PluginTCPSocketPrivate::GetInterface0_3(), true }, |
| 134 { PPB_TESTING_DEV_INTERFACE_0_9, PluginTesting::GetInterface(), true }, | 129 { PPB_TESTING_DEV_INTERFACE_0_9, PluginTesting::GetInterface(), true }, |
| 135 { PPB_TESTING_DEV_INTERFACE, PluginTesting::GetInterface(), true }, | 130 { PPB_TESTING_DEV_INTERFACE, PluginTesting::GetInterface(), true }, |
| 136 { PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2, | 131 { PPB_UDPSOCKET_PRIVATE_INTERFACE_0_2, |
| 137 PluginUDPSocketPrivate::GetInterface0_2(), true }, | 132 PluginUDPSocketPrivate::GetInterface0_2(), true }, |
| 138 { PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3, | 133 { PPB_UDPSOCKET_PRIVATE_INTERFACE_0_3, |
| 139 PluginUDPSocketPrivate::GetInterface0_3(), true }, | 134 PluginUDPSocketPrivate::GetInterface0_3(), true }, |
| 140 { PPB_URLLOADER_INTERFACE, PluginURLLoader::GetInterface(), true }, | 135 { PPB_URLLOADER_INTERFACE, PluginURLLoader::GetInterface(), true }, |
| 141 { PPB_URLREQUESTINFO_INTERFACE, PluginURLRequestInfo::GetInterface(), true }, | 136 { PPB_URLREQUESTINFO_INTERFACE, PluginURLRequestInfo::GetInterface(), true }, |
| 142 { PPB_URLRESPONSEINFO_INTERFACE, PluginURLResponseInfo::GetInterface(), | 137 { PPB_URLRESPONSEINFO_INTERFACE, PluginURLResponseInfo::GetInterface(), |
| 143 true }, | 138 true }, |
| 144 { PPB_VAR_ARRAY_BUFFER_INTERFACE, PluginVar::GetArrayBufferInterface(), | 139 { PPB_VAR_ARRAY_BUFFER_INTERFACE, PluginVar::GetArrayBufferInterface(), |
| 145 true }, | 140 true }, |
| 146 { PPB_VAR_INTERFACE, PluginVar::GetInterface(), true }, | 141 { PPB_VAR_INTERFACE, PluginVar::GetInterface(), true }, |
| 147 { PPB_VAR_INTERFACE_1_0, PluginVar::GetInterface1_0(), true }, | 142 { PPB_VAR_INTERFACE_1_0, PluginVar::GetInterface1_0(), true }, |
| 148 { PPB_VIEW_INTERFACE, PluginView::GetInterface(), true }, | 143 { PPB_VIEW_INTERFACE, PluginView::GetInterface(), true }, |
| 149 { PPB_WEBSOCKET_INTERFACE, PluginWebSocket::GetInterface(), | 144 { PPB_WEBSOCKET_INTERFACE, PluginWebSocket::GetInterface(), |
| 150 true }, | 145 true }, |
| 151 { PPB_WHEEL_INPUT_EVENT_INTERFACE, PluginInputEvent::GetWheelInterface(), | 146 { PPB_WHEEL_INPUT_EVENT_INTERFACE, PluginInputEvent::GetWheelInterface(), |
| 152 true }, | 147 true }, |
| 153 { PPB_WIDGET_DEV_INTERFACE, PluginWidget::GetInterface(), true }, | |
| 154 { PPB_ZOOM_DEV_INTERFACE, PluginZoom::GetInterface(), true }, | 148 { PPB_ZOOM_DEV_INTERFACE, PluginZoom::GetInterface(), true }, |
| 155 }; | 149 }; |
| 156 | 150 |
| 157 } // namespace | 151 } // namespace |
| 158 | 152 |
| 159 // Returns the pointer to the interface proxy or NULL if not yet supported. | 153 // Returns the pointer to the interface proxy or NULL if not yet supported. |
| 160 // On the first invocation for a given interface that has proxy support, | 154 // On the first invocation for a given interface that has proxy support, |
| 161 // also confirms over RPC that the browser indeed exports this interface. | 155 // also confirms over RPC that the browser indeed exports this interface. |
| 162 // Returns NULL otherwise. | 156 // Returns NULL otherwise. |
| 163 const void* GetBrowserInterface(const char* interface_name) { | 157 const void* GetBrowserInterface(const char* interface_name) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 189 interface_name, NaClSrpcErrorString(srpc_result)); | 183 interface_name, NaClSrpcErrorString(srpc_result)); |
| 190 if (srpc_result != NACL_SRPC_RESULT_OK || !browser_exports_interface) { | 184 if (srpc_result != NACL_SRPC_RESULT_OK || !browser_exports_interface) { |
| 191 interface_map[index].ppb_interface = NULL; | 185 interface_map[index].ppb_interface = NULL; |
| 192 ppb_interface = NULL; | 186 ppb_interface = NULL; |
| 193 } | 187 } |
| 194 interface_map[index].needs_browser_check = false; | 188 interface_map[index].needs_browser_check = false; |
| 195 return ppb_interface; | 189 return ppb_interface; |
| 196 } | 190 } |
| 197 | 191 |
| 198 } // namespace ppapi_proxy | 192 } // namespace ppapi_proxy |
| OLD | NEW |