• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The Chromium Authors
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 "components/nacl/renderer/plugin/ppapi_entrypoints.h"
6 
7 #include <stdint.h>
8 
9 #include "components/nacl/renderer/plugin/module_ppapi.h"
10 #include "ppapi/c/pp_errors.h"
11 #include "ppapi/c/pp_module.h"
12 #include "ppapi/c/ppb.h"
13 #include "ppapi/cpp/module.h"
14 #include "ppapi/cpp/private/internal_module.h"
15 
16 namespace nacl_plugin {
17 
PPP_InitializeModule(PP_Module module_id,PPB_GetInterface get_browser_interface)18 int32_t PPP_InitializeModule(PP_Module module_id,
19                              PPB_GetInterface get_browser_interface) {
20   plugin::ModulePpapi* module = new plugin::ModulePpapi();
21   if (!module->InternalInit(module_id, get_browser_interface)) {
22     delete module;
23     return PP_ERROR_FAILED;
24   }
25 
26   pp::InternalSetModuleSingleton(module);
27   return PP_OK;
28 }
29 
PPP_ShutdownModule()30 void PPP_ShutdownModule() {
31   delete pp::Module::Get();
32   pp::InternalSetModuleSingleton(NULL);
33 }
34 
PPP_GetInterface(const char * interface_name)35 const void* PPP_GetInterface(const char* interface_name) {
36   if (!pp::Module::Get())
37     return NULL;
38   return pp::Module::Get()->GetPluginInterface(interface_name);
39 }
40 
41 }  // namespace nacl_plugin
42