Google Chrome Extensions and NPAPI
Asked Answered
K

1

15

I need to write some Google Chrome extension. The problem is that Chrome JavaScript APIs don't give me enough power - I need to use native code. I thought about writing a NPAPI plug-in that will provide the extension some custom JS APIs.

Is it possible to package the extension, plus the custom NPAPI plugin inside a .crx, and then upload it to the Chrome Extensions Store?

Another issue with this method is that the NPAPI plugin will have many versions: Linux, Windows, OS X, x86, x86-64, etc. Is it possible to package all these in the crx and use the best version?

Thanks.

EDIT: After reading this, I realized that it's not possible to elegantly solve the multi-platform issue in one crx. But - is it possible to upload different crx-s for each platform to the Chrome extension store?

Koffler answered 12/11, 2010 at 12:18 Comment(1)
In your edit you said it's not possible, but is that still true in light of Mohamed's answer below?Obscurant
C
16

If you want multi platform in one CRX, you should put them in this order within the manifest:

"plugins": [
   { "path": "plugin-windows.dll" },
   { "path": "plugin-linux.so" },
   { "path": "plugin-mac.plugin" }
]

Remember uploading your NPAPI extension to the store will only work in Google Chrome Extensions. In the case of Google Chrome OS (which uses Google Chrome), you will not be able to use NPAPI.

But you should look into PPAPI which will be the recommended way doing plugin development for extension:

http://src.chromium.org/viewvc/chrome/trunk/src/ppapi/

In the meantime NPAPI in extensions, you need to follow this guide (which works great):

http://code.google.com/chrome/extensions/npapi.html

Just remember, do you really need to use NPAPI in your extension? If you could find a HTML5 workaround, it would be better.

Corse answered 12/11, 2010 at 15:0 Comment(4)
the dll/so files should be compiled for x86 or x86-64? In what versions of Google Chrome does PPAPI work?Koffler
PPAPI is currently work in progress, you can find more information regarding that, here: chromium.org/developers/design-documents/… Well, compilation shouldn't matter (afaik), I have a 64bit system and I compile it normally there and it works on 32bit platforms.Corse
@MohamedMansour For Linux it does matter. I have to compile *.so file separately for Linux 32-bit and 64-bit for project slimtext.orgGunfight
@TylerLong yea for Linux you need different architectures :)Corse

© 2022 - 2024 — McMap. All rights reserved.