Bug 979166 - Refactor dynamic toolbar code. r=lucasr

--HG--
extra : rebase_source : 9080c2ba012e608134f084cb5186195446ecad85