How to distribute a Native Messaging Host with Chrome Extension - google-chrome

I developed an extension that communicates with a host (also developed by me), as provided by the https://developer.chrome.com/extensions/nativeMessaging example, and it works just fine.
Now I need to distribute my host with my extension and I couldn't find in Distributions how can I package my host along my extension. Are there any examples of how can I do it? Or must I distribute my host elsewhere?

I couldn't find in Distributions how can I package my host along my extension.
Support for this has been requested and turned down by Chrome developers.
I would recommend reading that thread for some insights in how native hosts are supposed to work according to them.
Or must I distribute my host elsewhere?
That's the idea. You need an installer hosted somewhere else.
wOxxOm's proposal is not going to work seamlessly, since a Native host cannot function without registering it with the system (e.g. adding a registry key on Windows) - something an extension cannot trigger.
It's possible you can still follow the bundle-download-open route for an installer, but I imagine it may get frowned upon by Chrome Web Store.

Related

How Google Chrome extension check if a specific app installed on the client machine or not?

i want to know if it is possible for google chrome extension to check if there is already a native app installed on the client machine or not
So we established that you control both the extension and the native app.
Note that the extension cannot access the filesystem to check for existence of files; presumably, you also want to detect the presence of the app even if it's not running, and ideally be able to launch it if it isn't.
The best way to check that the app is installed is to provide a Native Messaging host in the app. The installer would then add a registry key to let Chrome know that the native host is present, and you can connect to it.
Now, there are some considerations:
You can't check the presence of the native host without trying to launch it.
The process launched that way lives only as long as its communication port is opened in the extension.
The communication channel between the extension and the app is the STDIO.
It would not be wise to just declare your main Windows Forms app as the native host. You should write a separate utility app that can communicate according to the Native Messaging protocol (even if to just answer "I'm here"). If needed, it can launch the main app and/or communicate with it as needed using other channels. You could also just launch the main app from your native host and then communicate with it using WebSockets.

install chrome extension outside the chrome extension market

As I know you can install an extension outside the market without expected limitations, for example, autoupdate. You need to be in develop mode.
You can read this thread to understand the problem:
Install chrome extension as external extensions
The think is, anyone know another way to install an extension in your chrome (internal use in a company o class). I like to think that I can sign the extension with a shared certificate or something like that. And send the extension to the users.
Google no longer allows it.
Protecting Chrome users from malicious extensions
Continuing to protect Chrome users from malicious extensions
There are 4 types of extension install still available:
Direct installation from Webstore or inline install from a website, but hosted on Web Store.
Indirect installation through registry manipulation (e.g. companion extension for a native app), but it still must be hosted in the Webstore.
Local development installs; will nag on every Chrome restart and no autoupdate mechanism.
For Enterprise only, policy-based installs. Note that on Windows that requires computers joined to a domain. In this case there are no restrictions on where the extension is hosted.

Restart Chrome native messaging host

I've written a Chrome extension and companion native messaging host. I don't have any issues with it failing to start or crashing, but I would like to be able to restart it for updates of the extension. I can't find anything in the documentation or elsewhere regarding this. Is it even possible, or does the browser need to be restarted? Due to the nature of the extension, I'd like to avoid restarting the browser if possible.
Documentation can be found here, but it's not exactly robust.
https://developer.chrome.com/extensions/nativeMessaging
Upon further investigation I have found that restarting the native host application manually is not required. Chrome does this itself on update of the extension. However, that breaks the ability to send messages to the native host application from content scripts that have already been loaded, which was causing the issue I was seeing. Pages can be reloaded to fix messaging.

What is the easiest way to find Chrome extension's id in a setup application?

I need to setup a native application which talks to a Chrome extension.
For that I am creating a setup, but I need the extension's id to be added in the native application's manifest file. That id says which extensions are allowed to talk with that native application.
How to get the extension id, assuming the user manually installs the extension by dragging and dropping.
Btw, To my knowledge installing an external chrome extension (no chrome web store) silently is close to impossible. I highly appreciate if someone has any solution for that, too.
The recommended flow would be to keep the extension in the Web Store (possibly unlisted if it does not work without the module), silently queue it for installation using the registry or other platform-specific method, and then warn the user to accept the install in the dialog on next browser restart. This is as close to "silent" as it gets.
If you absolutely have to distribute the extension externally (and drag&drop install will probably not work), you can pin the ID by setting the "key" field in the manifest. See this question for ways of doing so.

How to access system resources in Chrome Extensions

I am developing a chrome extension which needs to fetch some configuration from a system file... Earlier chrome provided NPAPI plug-ins, which could access any system resource (win registry, file system, IPC calls etc...)
However knowing that NPAPI will be discontinued soon, i am looking for alternatives.. one of the ways to build a plug-in is using Pepper clients, but pepper clients read/write only to chrome local storage.. which looks like a more data version of cookies...
So is there any other alternative to access system resources (like registry, files etc) in chrome extensions now??
The suggested alternative to NPAPI for many cases is "Native Messaging", where you provide an installer to users which adds binary code that chrome can communicate with via message passing. See http://developer.chrome.com/extensions/messaging.html#native-messaging.
For file access, in packaged apps there is the fileSystem API that lets you get access to the actual (non-sandboxed) filesystem. See http://developer.chrome.com/apps/fileSystem.html.