The contribution from extragalactic objects to the cosmic gamma-ray background