Skip to content

How to get ext to work with Chromium 43 on Ubuntu  #2

@markmuir87

Description

@markmuir87

Hi,

I've managed to get the integration plugin working. In the Extension - main.js file, need to change first line of 'sendMessage' function to:

sendMessage: function(application, parameters) {

    port = chrome.runtime.connectNative("com.ugetdm.integration");
    port.onDisconnect.addListener(Main.onDisconnected);
    port.postMessage({"application": application, "parameters": parameters});

}

Also need to alter default configure argument so that com.ugetdm.integration.json for the messaging host is installed at $HOME/.config/chromium/NativeMessagingHost and ensure that the extension ID matches the
"allowed_origins": [ "chrome-extension://hefmjpopoalekinolodikjlckoocbana/" ]
in the aforementioned file.

From memory, I think that's what got it working. Sorry for my crummy md formatting, I hope that makes sense. I'd make a pull request, but I kinda suck at github...

I assume you'd have to make similar changes to support closed-source chrome. I found this documentation most helpful: https://developer.chrome.com/extensions/nativeMessaging

Linux (user-specific, default path)
Google Chrome: ~/.config/google-chrome/NativeMessagingHosts/com.my_company.my_application.json
Chromium: ~/.config/chromium/NativeMessagingHosts/com.my_company.my_application.json

And there is an example of how to use native messaging on that page too:

var port = chrome.runtime.connectNative('com.my_company.my_application');
port.onMessage.addListener(function(msg) {
console.log("Received" + msg);
});
port.onDisconnect.addListener(function() {
console.log("Disconnected");
});
port.postMessage({ text: "Hello, my_application" });

This approach also means the extension can be installed on per-user basis without root access.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions