US grocery giant Safeway has agreed to a takeover bid from private-equity firm Cerberus Capital Management, the owner of chains including Albertsons, Acme and Jewel-Osco.