A Theory of Extrasolar Giant Planets