Molecular hydrogen emission in cooling flows