Mike,
In extension JS, I want to do the following.
chrome.browserAction.onClicked.addListener(function(tab) {
experimental.custom.getFooObject(function(FooObj) {
var sum = FooObj.val1 + FooObj.val2;
FooObj.SetSum(sum);
var storedSumVal = FooObj.GetSum();
});
});
In C++, I will be having a Foo Class.
Class Foo {
public:
void SetSum(int sum);
int GetSum();
int val1;
int val2;
int sum;
};
I am trying to write a new extension API (Let's say experimental.custom.getFooObject). From my understanding, when an extension JS calls this API, this call goes from the extension renderer process to the browser process. In the browser process, I want to do a DB access and return the results(val1 and val2) to Extension Renderer. In the extension renderer, I want to construct a C++ object using the results received from the browser process and return the newly constructed object to extension JS. From the extension JS, I should be able to access the member functions and data members of that C++ object.
I can make a custom Chromium build. In your previous reply, you said NPAPI Plugin. With NPAPi plugins, I cannot add utility classes to my JS namespace. I need to instantiate the new plugin element(<object>/<element>) and call the methods on that plugin element. Is it right? If so, I don't want to create new elements to the html file.
Can you explain in detail about bridging JavaScript to a Native Client application?
Thanks.