Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 The Native Client Authors. All rights reserved. | 1 // Copyright 2010 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_gles_extensions.h" | |
| 15 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.h" | 16 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_graphics_2d.h" |
| 16 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.h" | 17 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_image_data.h" |
| 17 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_instance.h" | 18 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_instance.h" |
| 18 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.h" | 19 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_loader.h" |
| 19 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.h" | 20 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_request_info.h" |
| 20 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.h" | 21 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_url_response_info.h" |
| 21 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h" | 22 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h" |
| 22 #include "native_client/src/shared/ppapi_proxy/plugin_surface_3d.h" | 23 #include "native_client/src/shared/ppapi_proxy/plugin_surface_3d.h" |
| 23 #include "native_client/src/shared/ppapi_proxy/utility.h" | 24 #include "native_client/src/shared/ppapi_proxy/utility.h" |
| 24 #include "srpcgen/ppb_rpc.h" | 25 #include "srpcgen/ppb_rpc.h" |
| 25 | 26 |
| 26 namespace ppapi_proxy { | 27 namespace ppapi_proxy { |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 struct InterfaceMapElement { | 31 struct InterfaceMapElement { |
| 31 const char* name; | 32 const char* name; |
| 32 const void* ppb_interface; | 33 const void* ppb_interface; |
| 33 bool needs_browser_check; | 34 bool needs_browser_check; |
| 34 }; | 35 }; |
| 35 | 36 |
| 36 // List of interfaces that have at least partial proxy support. | 37 // List of interfaces that have at least partial proxy support. |
| 37 InterfaceMapElement interface_map[] = { | 38 InterfaceMapElement interface_map[] = { |
| 38 { PPB_AUDIO_INTERFACE, PluginAudio::GetInterface(), true }, | 39 { PPB_AUDIO_INTERFACE, PluginAudio::GetInterface(), true }, |
| 39 { PPB_AUDIO_CONFIG_INTERFACE, PluginAudioConfig::GetInterface(), true }, | 40 { PPB_AUDIO_CONFIG_INTERFACE, PluginAudioConfig::GetInterface(), true }, |
| 40 { PPB_CORE_INTERFACE, PluginCore::GetInterface(), true }, | 41 { PPB_CORE_INTERFACE, PluginCore::GetInterface(), true }, |
| 41 { PPB_CONTEXT_3D_DEV_INTERFACE, PluginContext3D::GetInterface(), true }, | 42 { PPB_CONTEXT_3D_DEV_INTERFACE, PluginContext3D::GetInterface(), true }, |
| 43 { PPB_GLES_CHROMIUM_TEXTURE_MAPPING_DEV_INTERFACE, | |
| 44 GLESChromiumTextureMapping::GetInterface(), true }, | |
|
nfullagar
2011/02/24 02:07:51
hmm... we're going to do each block of gl extensio
| |
| 42 { PPB_GRAPHICS_2D_INTERFACE, PluginGraphics2D::GetInterface(), true }, | 45 { PPB_GRAPHICS_2D_INTERFACE, PluginGraphics2D::GetInterface(), true }, |
| 43 { PPB_IMAGEDATA_INTERFACE, PluginImageData::GetInterface(), true }, | 46 { PPB_IMAGEDATA_INTERFACE, PluginImageData::GetInterface(), true }, |
| 44 { PPB_INSTANCE_INTERFACE, PluginInstance::GetInterface(), true }, | 47 { PPB_INSTANCE_INTERFACE, PluginInstance::GetInterface(), true }, |
| 45 { PPB_OPENGLES2_DEV_INTERFACE, PluginContext3D::GetOpenGLESInterface(), | 48 { PPB_OPENGLES2_DEV_INTERFACE, PluginContext3D::GetOpenGLESInterface(), |
| 46 true }, | 49 true }, |
| 47 { PPB_SURFACE_3D_DEV_INTERFACE, PluginSurface3D::GetInterface(), true }, | 50 { PPB_SURFACE_3D_DEV_INTERFACE, PluginSurface3D::GetInterface(), true }, |
| 48 { PPB_URLLOADER_INTERFACE, PluginURLLoader::GetInterface(), true }, | 51 { PPB_URLLOADER_INTERFACE, PluginURLLoader::GetInterface(), true }, |
| 49 { PPB_URLREQUESTINFO_INTERFACE, PluginURLRequestInfo::GetInterface(), true }, | 52 { PPB_URLREQUESTINFO_INTERFACE, PluginURLRequestInfo::GetInterface(), true }, |
| 50 { PPB_URLRESPONSEINFO_INTERFACE, PluginURLResponseInfo::GetInterface(), | 53 { PPB_URLRESPONSEINFO_INTERFACE, PluginURLResponseInfo::GetInterface(), |
| 51 true }, | 54 true }, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 interface_name, NaClSrpcErrorString(srpc_result)); | 90 interface_name, NaClSrpcErrorString(srpc_result)); |
| 88 if (srpc_result != NACL_SRPC_RESULT_OK || !browser_exports_interface) { | 91 if (srpc_result != NACL_SRPC_RESULT_OK || !browser_exports_interface) { |
| 89 interface_map[index].ppb_interface = NULL; | 92 interface_map[index].ppb_interface = NULL; |
| 90 ppb_interface = NULL; | 93 ppb_interface = NULL; |
| 91 } | 94 } |
| 92 interface_map[index].needs_browser_check = false; | 95 interface_map[index].needs_browser_check = false; |
| 93 return ppb_interface; | 96 return ppb_interface; |
| 94 } | 97 } |
| 95 | 98 |
| 96 } // namespace ppapi_proxy | 99 } // namespace ppapi_proxy |
| OLD | NEW |