| OLD | NEW |
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 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 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 | 7 |
| 8 #include "ppapi/c/pp_completion_callback.h" | 8 #include "ppapi/c/pp_completion_callback.h" |
| 9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
| 10 #include "ppapi/c/pp_instance.h" | 10 #include "ppapi/c/pp_instance.h" |
| 11 #include "ppapi/c/pp_module.h" | 11 #include "ppapi/c/pp_module.h" |
| 12 #include "ppapi/c/pp_rect.h" | 12 #include "ppapi/c/pp_rect.h" |
| 13 #include "ppapi/c/pp_var.h" | 13 #include "ppapi/c/pp_var.h" |
| 14 #include "ppapi/c/ppb.h" | 14 #include "ppapi/c/ppb.h" |
| 15 #include "ppapi/c/ppb_core.h" | 15 #include "ppapi/c/ppb_core.h" |
| 16 #include "ppapi/c/ppb_graphics_2d.h" | 16 #include "ppapi/c/ppb_graphics_2d.h" |
| 17 #include "ppapi/c/ppb_image_data.h" | 17 #include "ppapi/c/ppb_image_data.h" |
| 18 #include "ppapi/c/ppb_instance.h" | 18 #include "ppapi/c/ppb_instance.h" |
| 19 #include "ppapi/c/ppb_view.h" | 19 #include "ppapi/c/ppb_view.h" |
| 20 #include "ppapi/c/ppp.h" | 20 #include "ppapi/c/ppp.h" |
| 21 #include "ppapi/c/ppp_instance.h" | 21 #include "ppapi/c/ppp_instance.h" |
| 22 | 22 |
| 23 PPB_GetInterface g_get_browser_interface = NULL; | 23 PPB_GetInterface g_get_browser_interface = NULL; |
| 24 | 24 |
| 25 const struct PPB_Core* g_core_interface; | 25 const PPB_Core* g_core_interface; |
| 26 const struct PPB_Graphics2D* g_graphics_2d_interface; | 26 const PPB_Graphics2D* g_graphics_2d_interface; |
| 27 const struct PPB_ImageData* g_image_data_interface; | 27 const PPB_ImageData* g_image_data_interface; |
| 28 const struct PPB_Instance* g_instance_interface; | 28 const PPB_Instance* g_instance_interface; |
| 29 const struct PPB_View* g_view_interface; | 29 const PPB_View* g_view_interface; |
| 30 | 30 |
| 31 /* PPP_Instance implementation -----------------------------------------------*/ | 31 /* PPP_Instance implementation -----------------------------------------------*/ |
| 32 | 32 |
| 33 struct InstanceInfo { | 33 struct InstanceInfo { |
| 34 PP_Instance pp_instance; | 34 PP_Instance pp_instance; |
| 35 struct PP_Size last_size; | 35 struct PP_Size last_size; |
| 36 | 36 |
| 37 struct InstanceInfo* next; | 37 struct InstanceInfo* next; |
| 38 }; | 38 }; |
| 39 | 39 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 } | 160 } |
| 161 | 161 |
| 162 void Instance_DidChangeFocus(PP_Instance pp_instance, PP_Bool has_focus) { | 162 void Instance_DidChangeFocus(PP_Instance pp_instance, PP_Bool has_focus) { |
| 163 } | 163 } |
| 164 | 164 |
| 165 PP_Bool Instance_HandleDocumentLoad(PP_Instance pp_instance, | 165 PP_Bool Instance_HandleDocumentLoad(PP_Instance pp_instance, |
| 166 PP_Resource pp_url_loader) { | 166 PP_Resource pp_url_loader) { |
| 167 return PP_FALSE; | 167 return PP_FALSE; |
| 168 } | 168 } |
| 169 | 169 |
| 170 static struct PPP_Instance instance_interface = { | 170 static PPP_Instance instance_interface = { |
| 171 &Instance_DidCreate, | 171 &Instance_DidCreate, |
| 172 &Instance_DidDestroy, | 172 &Instance_DidDestroy, |
| 173 &Instance_DidChangeView, | 173 &Instance_DidChangeView, |
| 174 &Instance_DidChangeFocus, | 174 &Instance_DidChangeFocus, |
| 175 &Instance_HandleDocumentLoad | 175 &Instance_HandleDocumentLoad |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 | 178 |
| 179 /* Global entrypoints --------------------------------------------------------*/ | 179 /* Global entrypoints --------------------------------------------------------*/ |
| 180 | 180 |
| 181 PP_EXPORT int32_t PPP_InitializeModule(PP_Module module, | 181 PP_EXPORT int32_t PPP_InitializeModule(PP_Module module, |
| 182 PPB_GetInterface get_browser_interface) { | 182 PPB_GetInterface get_browser_interface) { |
| 183 g_get_browser_interface = get_browser_interface; | 183 g_get_browser_interface = get_browser_interface; |
| 184 | 184 |
| 185 g_core_interface = (const struct PPB_Core*) | 185 g_core_interface = (const PPB_Core*) |
| 186 get_browser_interface(PPB_CORE_INTERFACE); | 186 get_browser_interface(PPB_CORE_INTERFACE); |
| 187 g_instance_interface = (const struct PPB_Instance*) | 187 g_instance_interface = (const PPB_Instance*) |
| 188 get_browser_interface(PPB_INSTANCE_INTERFACE); | 188 get_browser_interface(PPB_INSTANCE_INTERFACE); |
| 189 g_image_data_interface = (const struct PPB_ImageData*) | 189 g_image_data_interface = (const PPB_ImageData*) |
| 190 get_browser_interface(PPB_IMAGEDATA_INTERFACE); | 190 get_browser_interface(PPB_IMAGEDATA_INTERFACE); |
| 191 g_graphics_2d_interface = (const struct PPB_Graphics2D*) | 191 g_graphics_2d_interface = (const PPB_Graphics2D*) |
| 192 get_browser_interface(PPB_GRAPHICS_2D_INTERFACE); | 192 get_browser_interface(PPB_GRAPHICS_2D_INTERFACE); |
| 193 g_view_interface = (const struct PPB_View*) | 193 g_view_interface = (const PPB_View*) |
| 194 get_browser_interface(PPB_VIEW_INTERFACE); | 194 get_browser_interface(PPB_VIEW_INTERFACE); |
| 195 if (!g_core_interface || !g_instance_interface || !g_image_data_interface || | 195 if (!g_core_interface || !g_instance_interface || !g_image_data_interface || |
| 196 !g_graphics_2d_interface || !g_view_interface) | 196 !g_graphics_2d_interface || !g_view_interface) |
| 197 return -1; | 197 return -1; |
| 198 | 198 |
| 199 return PP_OK; | 199 return PP_OK; |
| 200 } | 200 } |
| 201 | 201 |
| 202 PP_EXPORT void PPP_ShutdownModule() { | 202 PP_EXPORT void PPP_ShutdownModule() { |
| 203 } | 203 } |
| 204 | 204 |
| 205 PP_EXPORT const void* PPP_GetInterface(const char* interface_name) { | 205 PP_EXPORT const void* PPP_GetInterface(const char* interface_name) { |
| 206 if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) | 206 if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) |
| 207 return &instance_interface; | 207 return &instance_interface; |
| 208 return NULL; | 208 return NULL; |
| 209 } | 209 } |
| 210 | |
| OLD | NEW |