Centurion Sam Hain shares a 165-run stand with skipper Ed Barnard against Leicestershire to edge Warwickshire close to a ninth County Championship title.