I am trying to set the extension icon to a canvas image. I can't seem to get it to set. I just want to get the basics working and expand from there. I can set the icon with an image in the file structure but I want to be able to dynamically update the text later.
I tried a few ways to get chrome.browserAction.setIcon to set to no avail. I hope it is not something simple I am missing.
Thanks
//chrome.browserAction.setIcon({imageData: draw()});
draw();
function draw() {
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
canvas.width = 19;
canvas.height = 19;
context.fillStyle = "#262626";
context.fillRect(0, 0, 19, 19);
context.textAlign = "center";
context.textBaseline = "middle";
context.font = "11px Arial";
context.fillText("69F", 8, 8);
chrome.browserAction.setIcon({
imageData: context.getImageData(0, 0, 19, 19)
});
//return context.getImageData(0, 0, 19, 19);
}