Apple and Facebook, the two online giants, are now in a battle over data privacy and market power that appears to be heading for the courts.