Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / components / nacl / renderer / plugin / ppapi_entrypoints.cc
blobcd35c9223e22054975134ef843cfb6d970d25aaf
1 // Copyright (c) 2014 The Chromium 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.
5 #include "components/nacl/renderer/plugin/ppapi_entrypoints.h"
7 #include "components/nacl/renderer/plugin/module_ppapi.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/pp_module.h"
10 #include "ppapi/c/ppb.h"
11 #include "ppapi/cpp/module.h"
12 #include "ppapi/cpp/private/internal_module.h"
14 namespace nacl_plugin {
16 int32_t PPP_InitializeModule(PP_Module module_id,
17 PPB_GetInterface get_browser_interface) {
18 plugin::ModulePpapi* module = new plugin::ModulePpapi();
19 if (!module->InternalInit(module_id, get_browser_interface)) {
20 delete module;
21 return PP_ERROR_FAILED;
24 pp::InternalSetModuleSingleton(module);
25 return PP_OK;
28 void PPP_ShutdownModule() {
29 delete pp::Module::Get();
30 pp::InternalSetModuleSingleton(NULL);
33 const void* PPP_GetInterface(const char* interface_name) {
34 if (!pp::Module::Get())
35 return NULL;
36 return pp::Module::Get()->GetPluginInterface(interface_name);
39 } // namespace nacl_plugin