+chromium-dev -chromium-extensions (This is more of a question of hacking on the chromium code than in writing extensions.)
On Thu, Oct 1, 2009 at 10:51 AM, Jeff Timanus <jeff.tima...@gmail.com> wrote: > Hi Erik & Extension Developers > I'm attempting to add some of the pop-up API functions that take a > dom-object as an argument, but I'm having some trouble figuring out the best > means to do it. > I've added the following code to the API json file > (chrome\common\extensions\api\extension_api.json), but I don't think it's > correct (nor does it work): > "name": "popup", > "type": "function", > "description": "Display a (!?) pop-up.", > "parameters": [ > {"type": "object", "name": "domElement"}, > {"type": "integer", "name": "width"}, > {"type": "integer", "name": "height"} > ] Yeah, this won't work. Parameters of type object have to have their schema defined as well. Also, even if you could define all of the properties, this still wouldn't do what you wanted. > I've looked through all of the existing APIs, and it seems that all of the > objects that are in-parameters are dictionary objects constructed by the > javascript code, as opposed to handles to native DOM objects. Is there a > trick here of which I'm not aware? What would you expect this to mean? Remember that this function call is being sent to the browser (in another process). What is a reference to a DOM element supposed to mean in this context? Ignoring the API that you want the caller to use, what API would you expect the browser to take? My memory is that you need this DOM element so that you know where to attach the popup. I think given this, you're going to need to implement some custom code rather than just using the default pass-through behavior. > An alternative that I'm currently exploring is to add a javascript handler > (in extension_process_bindings.js) to extract the relevant properties of the > DOM object before calling a native function with those arguments packaged in > primitive objects. Is this the sanctioned approach? Yes. When you need to do client-side transformations or other client-side behavior, then you need to add the function directly into extension_process_bindings.js. Erik --~--~---------~--~----~------------~-------~--~----~ Chromium Developers mailing list: chromium-dev@googlegroups.com View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~----------~----~----~----~------~----~------~--~---