I have been working on this for a while now, I can't figure this out. I've read the Chrome Native Messaging docs, but I keep getting a "Specified native messaging host not found." error from the extension.
Manifest pointed by registry:
{
"name": "com.fordcars.chromekeys",
"description": "ChromeKeys description",
"path": "C:\Users\fordcars\Desktop\Development\ChromeKeys\Debug\ChromeKeys.exe",
"type": "stdio",
"allowed_origins": [
"chrome-extension://pdkakljppghagmaoijbpicogfdbodpbc"
]
}
Extension script:
// Event page
var nativeName = "com.fordcars.chromekeys";
var nativePort = chrome.runtime.connectNative(nativeName);
function nativeDataReceived(data)
{
// Not used
}
function nativeDisconnected()
{
console.log("Native program disconnected. Error: " + chrome.runtime.lastError.message);
}
nativePort.onMessage.addListener(nativeDataReceived);
nativePort.onDisconnect.addListener(nativeDisconnected);
Keep in mind I get the error as soon as I connectNative(). I have "nativeMessaging" permission in my extension manifest.
Registry:
Subkey: HKEY_CURRENT_USER\Software\Google\Chrome\NativeMessagingHosts\com.fordcars.chromekeys
Value name: (Default)
Value: C:\Users\fordcars\Desktop\Development\ChromeKeys\Debug\nativeManifest.json
Debugging: I have done some debugging and have found that if I change my connectNative nativeName from com.fordcars.chromekeys to anything else, I still get the same error, so it is either not finding the registry key or/and I don't have a good manifest.json.
Thanks!