Extract onLinkBegin hook handling into separate class

Change-Id: Idfb3365a2b942770bec48091bbcd7cb32988f446