Is it okay to mount this switch with a metal box?
Extension cord cabling is not designed for permanent installations (someone will quote you the NEC reference, I'm sure). 
Is the receptacle properly grounded? 
If you attach the ground to the metal box or to the switch's ground connector (which is connected to the mounting yoke, which should make metal-to-metal contact with the box) the box itself will also be grounded and you shouldn't have a problem.