On Wed, Apr 22, 2009 at 4:38 PM, Aaron Boodman <[email protected]> wrote:
> > So Finnur is looking at the Page Actions API > ( > http://dev.chromium.org/developers/design-documents/extensions/page-actions-api > ). > Right now, the proposed API for creating one of these bad boys is: > > create({string name, [string javascript], [string faviconUrl], [bool > executeInPage]}, [function callback(PageAction new)]) > > > I would like to change two main things about this: > > a) Usually page actions are associated with a tab. When you switch > tabs, they should automatically be switched. The extension developer > shouldn't have to manually manage that. There are also page actions > which apply to every page, but we could support that separately. I think we should probably provide both. The API you propose looks good for the per-tab case. We could have the same API without a tabID for the cross-tab case. > > > b) I would like the callback to be in the form of a function, not a > string of JavaScript. Functions are better because they can have > closures that allow you to keep references to local state, and are > just more JavaScripty in general. Where would this function execute? In the extension context or the page context? A lot of the bookmarklet-like use cases are easier to implement in the page context. > > > > So I would change it to something like: > > create({string name, int tabId, string iconUrl, function onExecute()}, > [function callback(PageAction new)]) How about get/delete/update? We talked about limiting these to actions created by the extension. > > > Note that the second callback is just basically telling you "yes, it > was registered!". There would eventually be a third optional callback > for errors ("no, that tab id doesn't even exist!"). > > > Thoughts on these changes? It would require some changes to enable > ExtensionFunctions to have lifetimes beyond the stack frame, but I > think that is a good thing because we want to support this style of > API for other things in the future, like navigation or history > searches. > > > - a > > > > --~--~---------~--~----~------------~-------~--~----~ Chromium Developers mailing list: [email protected] View archives, change email options, or unsubscribe: http://groups.google.com/group/chromium-dev -~----------~----~----~----~------~----~------~--~---
