The generalized second law in chameleon cosmology