Government and manufacturer and service provider along with the constituency coming to a decision on what should and should not be allowable.
As I understand it, the gov, is setting up a commission to investigate this question, as it should [1].
As for mr Cook, I agree, what he speculates to should not happen, and as far as I know is not happening. He's essentially setting up a strawperson argument when he states: "If a court can ask us to write this software, think about what else they could ask us to write. Maybe it’s an operating system for surveillance, maybe the ability for law enforcement to turn on the camera."
[1]http://www.buzzfeed.com/hamzashaban/lawmakers-in-congress-in...