Move some code to legacy_browser plugin