Eventually I started Oplop and my focus shifted to HTML5 web apps thanks to my Ph.D. (which I have started writing). But I still kept an eye on Chrome's approach to extensions (which Mozilla Jetpack takes a similar approach). Finally I found the time to give it a shot.
Chrome extensions fall into three types: browser actions, page actions, and content scripts. Browser actions are the icons you see to the right of omnibox. Those are extensions whose icons are always present no matter what the browser is showing you and will present a popup when you click the icon. A page action is an extension where the icon shows up within the omnibox at its far right edge. This is for extensions that conditionally want to present you with a popup (like Oplop only being useful on pages with a password field). Lastly there are content scripts which run based on a regex for the URL of the page being viewed. They have no visible icon. Now you can mix and match any of these three approaches, e.g. Oplop is a page action as it only shows itself when needed, but a it also uses a content script to find out what pages have a password field.
The real trick in all of this is when you have to start communicating between the various parts. Content scripts run in their own space, as do background pages and popups. But content scripts run in a very restricted space since they can mutate the running tab's DOM. And things get a little bit more complicated as the background page is running for every tab while content scripts and popups are only running for their respective tab. So how the heck do you tie all of this stuff together?
Content scripts communicate through message passing. You can either do one-off messages or open a port that stays open. Now anyone can communicate with content scripts, including popups, so you kind of have to be careful when using one-time messages that you don't interleave communication through the extensions' mailbox. You can do the long-running message port if you want and store the port so that you send multiple pieces of information. The trick here seems to be having the background page truly act as the central controller. Basically you have any communication dealing with content scripts either start or terminate in the background page. If a popup needs to communicate with a content script it's best to have the background page implement a function for communicating and then use
chrome.extension.getBackgroundPage()to send the message on the popup's behalf. You can use
chrome.tabs.getSelected()in a popup to find out what the current tab happens to be in so you can send the message to the right content script by having the background page store the port or callback response function in an object keyed on tab ID.
The communication thing was the hardest thing I found. Everything else made sense. It's actually so straightforward that I have a catch-all extension which I have do stuff for me, e.g. skip full-screen ads. So if you are a Chrome user and have ever had an interest in writing an extension I recommend giving it a try.