Measurement of the prompt J/ψ and ψ(2S) polarizations in pp collisions at s=7 TeV