Don't know about how Chrome triggers its extensions, but I can tell you about page content manipulation.
To wrap all the child content of a topbar
div in plain JavaScript:
var topbars= document.getElementsByClassName('topbar');
for (var i= topbars.length; i-->0;) {
var span= document.createElement('span');
span.className= 'larger-font';
while (topbars[i].firstChild)
span.appendChild(topbars[i].firstChild);
topbars[i].appendChild(span);
}
(getElementsByClassName is a relatively new API, but Chrome 3 supports it. For each matching element, move all its children into a new span element, and put that span inside the div.)
Or using jQuery, if you don't mind dragging a great big framework in:
$('.topbar').each(function() {
$(this).contents().wrapAll('<span class="larger-font"></span>');
});
Whilst you can operate on HTML as strings, using something like:
for (var i= topbars.length; i-->0;)
topbars[i].innerHTML= '<span class="larger-font">'+topbars[i].innerHTML+'</span>';
this should in general be avoided, as you will be serialising and re-parsing the entire node contents of the div, in the process destroying any non-serialisable content like JavaScript references, event listeners and form field values.