javascriptpluginschromiumppapipepper

How to customize a ppapi which could be used by Javascript?


I am researching on the Chromium PPAPI. After looking through all APIs from the official reference here: https://developer.chrome.com/native-client/cpp-api-dev, I seldom found any APIs that could be used by, or communicate with JS directly. In my opinion, a plugin process will set up a PP::instance and all functions within this instance would be loaded. Take video_capture.cc as an example, you could find it under /ppapi/examples/video_capture in chromium source codes. In this example, a customized PP::instance called VCDemoInstance registered some methods, yet I found only HandleMessage() could communicate with JS layer. From JS, you might use postMessage() to pass something to HandleMessage() above.

So here is my key question: Is there a way to create or define a method in PP::instance that could be used by or communicated with JS layer directly? Is it possible to register a JS object and call PPAPI like obj.apiFromPlugin? At lease I knew in Opera JSPP framework, it could be done.

Please correct me if anything is wrong. You're appreciated.


Solution

  • After digging into PPAPI, I couldn't find a way to create an JS object in plugin. I finally switched to Chromium Embed Framework which can port content API to JS. Using CefV8Handler may solve my question absolutely.