OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "native_client/src/shared/platform/nacl_check.h" |
| 6 |
| 7 #include "ppapi/c/dev/ppb_context_3d_dev.h" |
| 8 #include "ppapi/c/dev/ppb_cursor_control_dev.h" |
| 9 #include "ppapi/c/dev/ppb_font_dev.h" |
| 10 #include "ppapi/c/dev/ppb_graphics_3d_dev.h" |
| 11 #include "ppapi/c/dev/ppb_memory_dev.h" |
| 12 #include "ppapi/c/dev/ppb_opengles_dev.h" |
| 13 #include "ppapi/c/dev/ppb_scrollbar_dev.h" |
| 14 #include "ppapi/c/dev/ppb_surface_3d_dev.h" |
| 15 #include "ppapi/c/dev/ppb_testing_dev.h" |
| 16 #include "ppapi/c/dev/ppb_var_deprecated.h" |
| 17 #include "ppapi/c/dev/ppb_widget_dev.h" |
| 18 #include "ppapi/c/ppb_core.h" |
| 19 #include "ppapi/c/ppb_file_io.h" |
| 20 #include "ppapi/c/ppb_file_ref.h" |
| 21 #include "ppapi/c/ppb_file_system.h" |
| 22 #include "ppapi/c/ppb_graphics_2d.h" |
| 23 #include "ppapi/c/ppb_image_data.h" |
| 24 #include "ppapi/c/ppb_input_event.h" |
| 25 #include "ppapi/c/ppb_instance.h" |
| 26 #include "ppapi/c/ppb_messaging.h" |
| 27 #include "ppapi/c/ppb_url_loader.h" |
| 28 #include "ppapi/c/ppb_url_request_info.h" |
| 29 #include "ppapi/c/ppb_url_response_info.h" |
| 30 #include "ppapi/c/ppb_var.h" |
| 31 |
| 32 #include "native_client/tests/ppapi_test_lib/get_browser_interface.h" |
| 33 #include "native_client/tests/ppapi_test_lib/internal_utils.h" |
| 34 |
| 35 const void* GetBrowserInterface(const char* interface_name) { |
| 36 return (*ppb_get_interface())(interface_name); |
| 37 } |
| 38 |
| 39 const void* GetBrowserInterfaceSafe(const char* interface_name) { |
| 40 const void* ppb_interface = (*ppb_get_interface())(interface_name); |
| 41 CHECK(ppb_interface != NULL); |
| 42 return ppb_interface; |
| 43 } |
| 44 |
| 45 // Stable interfaces. |
| 46 |
| 47 const PPB_Core* PPBCore() { |
| 48 return reinterpret_cast<const PPB_Core*>( |
| 49 GetBrowserInterfaceSafe(PPB_CORE_INTERFACE)); |
| 50 } |
| 51 |
| 52 const PPB_FileIO* PPBFileIO() { |
| 53 return reinterpret_cast<const PPB_FileIO*>( |
| 54 GetBrowserInterface(PPB_FILEIO_INTERFACE)); |
| 55 } |
| 56 |
| 57 const PPB_FileRef* PPBFileRef() { |
| 58 return reinterpret_cast<const PPB_FileRef*>( |
| 59 GetBrowserInterface(PPB_FILEREF_INTERFACE)); |
| 60 } |
| 61 |
| 62 const PPB_FileSystem* PPBFileSystem() { |
| 63 return reinterpret_cast<const PPB_FileSystem*>( |
| 64 GetBrowserInterface(PPB_FILESYSTEM_INTERFACE)); |
| 65 } |
| 66 |
| 67 const PPB_Graphics2D* PPBGraphics2D() { |
| 68 return reinterpret_cast<const PPB_Graphics2D*>( |
| 69 GetBrowserInterfaceSafe(PPB_GRAPHICS_2D_INTERFACE)); |
| 70 } |
| 71 |
| 72 const PPB_ImageData* PPBImageData() { |
| 73 return reinterpret_cast<const PPB_ImageData*>( |
| 74 GetBrowserInterfaceSafe(PPB_IMAGEDATA_INTERFACE)); |
| 75 } |
| 76 |
| 77 const PPB_InputEvent* PPBInputEvent() { |
| 78 return reinterpret_cast<const PPB_InputEvent*>( |
| 79 GetBrowserInterfaceSafe(PPB_INPUT_EVENT_INTERFACE)); |
| 80 } |
| 81 |
| 82 const PPB_Instance* PPBInstance() { |
| 83 return reinterpret_cast<const PPB_Instance*>( |
| 84 GetBrowserInterfaceSafe(PPB_INSTANCE_INTERFACE)); |
| 85 } |
| 86 |
| 87 const PPB_KeyboardInputEvent* PPBKeyboardInputEvent() { |
| 88 return reinterpret_cast<const PPB_KeyboardInputEvent*>( |
| 89 GetBrowserInterfaceSafe(PPB_KEYBOARD_INPUT_EVENT_INTERFACE)); |
| 90 } |
| 91 |
| 92 const PPB_Messaging* PPBMessaging() { |
| 93 return reinterpret_cast<const PPB_Messaging*>( |
| 94 GetBrowserInterfaceSafe(PPB_MESSAGING_INTERFACE)); |
| 95 } |
| 96 |
| 97 const PPB_MouseInputEvent* PPBMouseInputEvent() { |
| 98 return reinterpret_cast<const PPB_MouseInputEvent*>( |
| 99 GetBrowserInterfaceSafe(PPB_MOUSE_INPUT_EVENT_INTERFACE)); |
| 100 } |
| 101 |
| 102 const PPB_URLLoader* PPBURLLoader() { |
| 103 return reinterpret_cast<const PPB_URLLoader*>( |
| 104 GetBrowserInterfaceSafe(PPB_URLLOADER_INTERFACE)); |
| 105 } |
| 106 |
| 107 const PPB_URLRequestInfo* PPBURLRequestInfo() { |
| 108 return reinterpret_cast<const PPB_URLRequestInfo*>( |
| 109 GetBrowserInterfaceSafe(PPB_URLREQUESTINFO_INTERFACE)); |
| 110 } |
| 111 |
| 112 const PPB_URLResponseInfo* PPBURLResponseInfo() { |
| 113 return reinterpret_cast<const PPB_URLResponseInfo*>( |
| 114 GetBrowserInterfaceSafe(PPB_URLRESPONSEINFO_INTERFACE)); |
| 115 } |
| 116 |
| 117 const PPB_Var* PPBVar() { |
| 118 return reinterpret_cast<const PPB_Var*>( |
| 119 GetBrowserInterfaceSafe(PPB_VAR_INTERFACE)); |
| 120 } |
| 121 |
| 122 const PPB_WheelInputEvent* PPBWheelInputEvent() { |
| 123 return reinterpret_cast<const PPB_WheelInputEvent*>( |
| 124 GetBrowserInterfaceSafe(PPB_WHEEL_INPUT_EVENT_INTERFACE)); |
| 125 } |
| 126 |
| 127 |
| 128 // Dev interfaces. |
| 129 |
| 130 const PPB_Context3D_Dev* PPBContext3DDev() { |
| 131 return reinterpret_cast<const PPB_Context3D_Dev*>( |
| 132 GetBrowserInterface(PPB_CONTEXT_3D_DEV_INTERFACE)); |
| 133 } |
| 134 |
| 135 const PPB_CursorControl_Dev* PPBCursorControlDev() { |
| 136 return reinterpret_cast<const PPB_CursorControl_Dev*>( |
| 137 GetBrowserInterface(PPB_CURSOR_CONTROL_DEV_INTERFACE)); |
| 138 } |
| 139 |
| 140 const PPB_Graphics3D_Dev* PPBGraphics3DDev() { |
| 141 return reinterpret_cast<const PPB_Graphics3D_Dev*>( |
| 142 GetBrowserInterface(PPB_GRAPHICS_3D_DEV_INTERFACE)); |
| 143 } |
| 144 |
| 145 const PPB_Font_Dev* PPBFontDev() { |
| 146 return reinterpret_cast<const PPB_Font_Dev*>( |
| 147 GetBrowserInterface(PPB_FONT_DEV_INTERFACE)); |
| 148 } |
| 149 |
| 150 const PPB_Memory_Dev* PPBMemoryDev() { |
| 151 return reinterpret_cast<const PPB_Memory_Dev*>( |
| 152 GetBrowserInterface(PPB_MEMORY_DEV_INTERFACE)); |
| 153 } |
| 154 |
| 155 const PPB_OpenGLES2_Dev* PPBOpenGLES2Dev() { |
| 156 return reinterpret_cast<const PPB_OpenGLES2_Dev*>( |
| 157 GetBrowserInterface(PPB_OPENGLES2_DEV_INTERFACE)); |
| 158 } |
| 159 |
| 160 const PPB_Scrollbar_Dev* PPBScrollbarDev() { |
| 161 return reinterpret_cast<const PPB_Scrollbar_Dev*>( |
| 162 GetBrowserInterface(PPB_SCROLLBAR_DEV_INTERFACE)); |
| 163 } |
| 164 |
| 165 const PPB_Surface3D_Dev* PPBSurface3DDev() { |
| 166 return reinterpret_cast<const PPB_Surface3D_Dev*>( |
| 167 GetBrowserInterface(PPB_SURFACE_3D_DEV_INTERFACE)); |
| 168 } |
| 169 |
| 170 const PPB_Testing_Dev* PPBTestingDev() { |
| 171 return reinterpret_cast<const PPB_Testing_Dev*>( |
| 172 GetBrowserInterface(PPB_TESTING_DEV_INTERFACE)); |
| 173 } |
| 174 |
| 175 const PPB_Widget_Dev* PPBWidgetDev() { |
| 176 return reinterpret_cast<const PPB_Widget_Dev*>( |
| 177 GetBrowserInterface(PPB_WIDGET_DEV_INTERFACE)); |
| 178 } |
| 179 |
OLD | NEW |