Any example of writing an NPAPI plugin in Linux? - google-chrome

I need to write a browser plugin to communicate with another process, and it seems I have to use NPAPI plugins. Is there any example or open source NPAPI plugin I can refer to?
Many thanks for your reply.
Summary of answers
http://mxr.mozilla.org/seamonkey/source/modules/plugin/samples/
http://www.firebreath.org/
http://code.google.com/p/nixysa/
http://code.google.com/p/npapi-file-io/
2 and 3 are both frameworks to make plugin development easier.
I found one example at
http://mxr.mozilla.org/seamonkey/source/modules/plugin/samples/

you could also use the open source FireBreath plugin framework; they are nearing a 1.0 release for windows only, but it would not be hard to port it to linux; mac os shouldn't be bad either, but it will take a little work to get CMake to generate the correct bundle type =]
Yes, I am one of the primary maintainers, so I'm a bit biased. You can also find some good general information on how NPAPI works on my blog, starting here:
http://colonelpanic.net/2009/03/building-a-firefox-plugin-part-one/

Related

Cross-compile Firebreath plugin ARM

I need to compile a Firebreath plugin for our ARM linux-based device. I don't see any section on the docs that mention how to specify what toolchain and compiler to use.
Anyone can give a tip on that?
Thanks!
The reason there is no section in the docs is because as far as I know nobody has ever done it =] (and I wrote FireBreath, so it's not unlikely that I would have heard about it)
This would be a cmake problem -- look at what the prep scripts are doing, particularly prepcommon.sh, and how they use cmake. You'd need to figure out how to tell cmake to use an arm-targetting toolchain. You also need to find out if there is anything different about the NPAPI implementation on your platform. Keep in mind as well that NPAPI in Firefox is going away in the release planned for early March.
FireBreath2 will support FireFox and Chrome via native messaging but I have no idea what may or may not be different on ARM for that. To do what you want to do you'll need to learn a bit more about both FireBreath and cmake.

native browser plugins alternatives to NPAPI

Hello as you might now NPAPI is deprecated.
What are the alternatives to this? I see skype released now the web version where you need to install a web plugin to make voice and video calls. Looking over what I installed I arrived to the conclusion that on chrome they are using Google Native Client: https://developer.chrome.com/native-client
But this one is not supported on firefox/safari (only chrome).
On Firefox/Safary I'm not sure what they are using.
So what are now the best alternatives for this kind of job where using c++ is mandatory (to extend an existing app and make it available as web plugin)
Silviu
After Chrome drop the NPAPI support, there is no-common technology support by Firefox/Chrome/Safari. You can consider about Firebreath 2.0. It allow you use one C++ implement to support different browser.
It's not released yet... If you like to try version 2.0, you can get source code from https://github.org/firebreath/firebreath (the "refactor" branch)
Note: version 2.0 make huge change, because the call between plugin and javascript are asynchronous! Upgrade from older version required lots of javascript change.

NPAPI Browser plugin

Is there any free NPAPI plugin that could provide full access to local file system?
Maybe there are some ready-for-use universal plugins which provide access to many OS native api functions?
Such a plugin would be highly dangerous; Generally people are bright enough not to leave things like that just laying around.
You could build such a thing using FireBreath, but it is very difficult to lock it down enough that nobody could create a malicious website that would use it to trash your computer.

Is a NPAPI plugin what I am looking for?

I need to develop a mini ClickOnce plugin for Firefox, Chrome, Operah and Safari (preferably, one that works on all of the above).
My plugin needs to be able to run an application in a one-click fashion. In other words, by going to a specific URL, my application will run on the target machine (no prompts / dialogs shown). Unfortunately, ClickOnce is only available with IE, and I am unhappy with the ClickOnce plugins that currently exist. I would like to develop a tailored ClickOnce plugin that suits my specific needs.
I read about FireBreath, which sounded like a perfect solution for me. I also read about the difference between an extension and a plugin and I think a plugin is what I am looking for. I just wanted to make sure with you guys that I am on the right path. Is what I want to achieve possible with FireBreath / NPAPI plugins? Can a plugin download an executable and then run it on a target machine?
Yes, NPAPI will allow you to do what you want. You can run arbitrary native code using an NPAPI plugin, and control it via JavaScript on the web page side. Users will have to download and install your plugin though, so it only makes sense if this is something users will use more than once.
You'll obviously have to be very, very careful about security though. If you make a plugin whose sole purpose is to download and run code without user interaction then you'll need to be absolutely certain that there's no way for a malicious page to use your plugin.

How many versions of an NPAPI browser plugin do I have to make?

I know that if I write a C++ plugin, then I need to have Linux, Mac, Windows versions at least but what's the full list of combinations? NPAPI is supported by many browsers so does that mean the exact same compiled NPAPI plugin binary/installer/whatever for Windows is ready for use in all those browsers on Windows which support NPAPI? Or do you have to 'compile' the same plugin code separately for each browser in some way?
Yes, a single NPAPI plugin runs in every NPAPI-supporting browser on a given platform, as long as you don't do anything to specifically undermine that (e.g., some people make NPAPI plugins but then add XPCOM code to them, making them Firefox-specific).
Additionally, as you probably saw in the answer to your other question, FireBreath can be used to create a single plugin that can be made to work cross platform on pretty much all browsers, including IE on windows.
FireBreath strongly discourages using things like XPCOM for exactly the reason that smorgan mentioned.