MDL-40931 useragent: separated user agent functionality into a lib

This commit moves user agent related functionality out of several
core libraries and combines it into a more manageable class.
All core uses are converted and functions deprecated in favor
of the new class.