我使用了以下命令行参数在CEF浏览器中注册PPAPI插件(stub.dll):
cefsimple --ppapi-out-of-process --register-pepper-plugins="D:\Documents\Programming\c++\PPAPI\stub\Debug\stub.dll;application/x-ppapi-stub" --url=file:///D:/Documents/Programming/c++/PPAPI/stub/stub.html
在跳出的CEF浏览器窗口中提示错误"Couldn't load plugin",错误截图如下:
我的CEF浏览器(cefsimple)是由官方发布的CEF案例编译而成,版本号98.1.21(亦尝试过3.2704.1414版本),在https://github.com/chromiumembedded/cef/tree/master/tests/cefsimple
尝试加载的PPAPI插件(stub.dll)源码如下:
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This is the simplest possible C Pepper plugin that does nothing. If you're
// using C++, you will want to look at stub.cc which uses the more convenient
// C++ wrappers.
#include <stddef.h>
#include <stdint.h>
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/pp_module.h"
#include "ppapi/c/ppb.h"
#include "ppapi/c/ppp.h"
PP_Module g_module_id;
PPB_GetInterface g_get_browser_interface = NULL;
PP_EXPORT int32_t PPP_InitializeModule(PP_Module module_id,
PPB_GetInterface get_browser_interface) {
// Save the global module information for later.
g_module_id = module_id;
g_get_browser_interface = get_browser_interface;
return PP_OK;
}
PP_EXPORT void PPP_ShutdownModule() {
}
PP_EXPORT const void* PPP_GetInterface(const char* interface_name) {
// You will normally implement a getter for at least PPP_INSTANCE_INTERFACE
// here.
return NULL;
}
打开的HTML文件(stub.html)源码如下:
<!DOCTYPE html>
<html>
<head>
<title>stub</title>
</head>
<body>
<H1>The HTML page had been loaded</H1>
<embed id="plugin" type="application/x-ppapi-stub">
</body>
</html>