Updates:
        Cc: [email protected] [email protected]

Comment #2 on issue 13936 by [email protected]: Implement extension specific  
events
http://code.google.com/p/chromium/issues/detail?id=13936

+mpcomplete, erikkay

Ok, to recap, the desire is to have an API like this:

chrome.pageActions["myPageAction"].addListener(function(args) {
...
});

In order to do this, we need to communicate to each extension process the  
page actions that are associated with each
extension that are running in the process (multiple extensions can  
sometimes run in one process).

However, we don't before have a single chokepoint where we know that an  
extension is running in a renderer for the
first time. This can triggered by: background pages, toolstrips, and tab  
contents. Background pages and toolstrips
are both handled by ExtensionView, and we could put code in there, but tab  
contents are handled by TabContents, so
we'd also have to put duplicate code there. Blech.

With r19717, we now have this chokepoint. ExtensionFunctionDispatcher is  
now always constructed at just the right
time to send this kind of information to renderers. It is created in  
RenderViewHostDelegate::RenderViewCreated() in
all cases.

So I think we should do something like:

* In ExtensionProcessBindings keep a static map of extension ID to list of  
page actions.

* When extension_process_bindings.js starts up, it asks  
ExtensionProcessBindings for a list of page actions and uses
this to set up all the correct events.

* Keep a map in ExtensionProcessManager maintaining which extensions are  
running in which processes.

* When ExtensionFunctionDispatcher is constructed and deleted, tell  
ExtensionProcessManager so that it can update its
state.

* The first time ExtensionProcessManager sees a particular extension, it  
sends the hosting process an IPC telling it
the page actions applicable for that extension.


It is a little awkward to have ExtensionFunctionDispatcher be responsible  
for updating ExtensionProcessManager, but:

a) It is the one that has all the proper state. We can't just send a  
notification from RenderViewHost because
RenderViewHost doesn't know what URL it is displaying.

b) In the future I expect to split ExtensionFunctionDispatcher in two  
pieces: a general purpose function dispatching
thing which will also be used by DOMUI, and the extension-specific stuff,  
which I will rename something like
ExtensionViewContext.


Matt, Erik, Finnur... thoughts?

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/group/chromium-bugs
-~----------~----~----~----~------~----~------~--~---

Reply via email to