The company complied with a classified U.S. government demand to look through millions of accounts at the behest of the National Security Agency or FBI, sources say.