Quick solution that came to my mind:
A chrome extension can read files within its own directory.
So I would suggest to create a function in background.js that periodically (adjust the granularity as per your needs), reads some file within the extensions directory using chrome.extension.getURL, XMLHttpRequest and "GET" command.
Then execute the command stated in the file.
From your C/C++/Bash controlling program, you can send the commands.
Here is an example of the function:
function read_control_file() {
var url = chrome.extension.getURL("control_cmd.txt");
var request = new XMLHttpRequest();
// false so that request is processed immediately and we need not pass callback
request.open("GET", url, false);
request.send();
return request.responseText;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…