A homeless man is in custody after allegedly trying to rape a mother in front of her toddler in Southern California.