Search code examples
google-chromeppapi

Register PPAPI plugin to Chrome


I am developing an out-of-process plugin for Chrome, where I need some kind of resource management mechanism (shared memory) that can be used by multiple processes. Then I found the Pepper plugin and it looks promising to achieve my goal.

Here provided in ppapi example folder is a simple stub plugin. According to another document I could load it by the following command:

chrome.exe --ppapi-out-of-process --register-pepper-plugins="[chromium_path]\src\build\Debug\ppapi_example_cc_stub.dll;application/x-ppapi-example-stub"

The problem is that I did not find a clean way to load it without specify the dll path and the MIME type, thus the plugin can be simply loaded by starting the Chrome executable.

I guess I need to add new items to Windows Registry or define a manifest.json file, but I do not know how to. Can some one give me an idea?

Thanks!


Solution

  • I encounted the same problem when developing my PPAPI plugin. But open the chrome://plugins, there are 3 PPAPI plguins. others are NPAPI plugin. I modify the file name of PPAPI plugins dll (pdf.dll). restart the chrome. I found that the chrome internel pdf plugin not work.

    I belive that the registration information of PPAPI plugin is fixed in the executable binary file of chrome browser. Search the sources of chromium, I found this.

    // File name of the internal PDF plugin on different platforms.
    const FilePath::CharType kInternalPDFPluginFileName[] =
    #if defined(OS_WIN)
        FILE_PATH_LITERAL("pdf.dll");
    #elif defined(OS_MACOSX)
        FILE_PATH_LITERAL("PDF.plugin");
    #else  // Linux and Chrome OS
        FILE_PATH_LITERAL("libpdf.so");
    #endif
    

    So maybe the npapi is more practical.