What could Google have done better? (Specifically in regards to this case. And assuming they pushed back on orders like this, like they claim to do.)
Now, before you say "What, do you expect them to break the law?", consider that they routinely push the boundaries of US law (securities law, copyright law, tax law, etc.) and lo and behold they are usually successful.
Now, I expect you might say "What you're suggesting is still nonsensical because resisting orders related to national security is, among other things, far too controversial and not in the interests of shareholders." And I would not disgaree with you.
My point is simply that Google, with its vast resources, is in a much better position than Ed Snowden to take on this fight for the future of the Internet and privacy of communications.
You could even argue Google has more skin in the game than Mr. Snowden, or any of us individually (aside from those who exploit others' private information for profit, of course)... because if this controversy brings about knee-jerk changes in privacy law, it could materially affect their bottom line.