Headers refactoring

* Move code from ExtMobileFrontend to MobileFrontendHooks because it's more
  logical - headers should be sent when we're displaying a mobile skin, not
  when we're processing HTML.
* Add an explicit check for mobile mode, because before it was only accidentally
  that we weren't sending X-Analytics to desktop.

This moves some changes out of https://gerrit.wikimedia.org/r/#/c/69336/

Change-Id: I618c6124a23232b27ad3223240550519ec76dda5