Move key handling from background page into the tab