As far as I know, the speed of light is constant only when it travels through a vacuum. This means the speed of light will remain constant as far it is moving through a vacuum, and it will always be 300,000 km/s. Although, the speed of light is believed to be constant in a sense, however, the fact still remains that it can be slowed down, especially when it travels through a medium like glass or air. When light travels through a vacuum, the refractive index is always 1.0, but the refractive index tends to change as light passes through a medium.
Most times, the refractive index of the new medium tends to increase, and this is exactly what is causing the reduction to the speed of light. What happens when light passes through a medium is that the electrons in the medium absorb light energy and they get excited, although this may not affect the speed of light.