Factor out profile trigger code into separate class.

Makes it easier to extend the trigger mechanism later on.

Change-Id: Ied318e7efa7e1755022deecb8172f862943ca6ac