Mac: Don't crash trying to process a menu command during shutdown.

When something calls chrome::AttemptExit(), lots of stuff happens.
It involves RunLoops, and there's no guarantee the OS won't put
something into the event queue while Chrome is cleaning up the last
browser window.

If that "something" is "Open a New Window" BrowserProcessImpl::Pin()
gets unhappy and will CHECK() because it thought the last browser
window was already closed.

To fix, don't allow AppController to process commands after it has
cleared its keep alive. Since, this may trigger BrowserProcessImpl::UnPin()
and enter this state where it's prohibited to open new windows.

Bug: 779829
Change-Id: I4ac2533d27ed724bc24cf546be69560506705cb8
Reviewed-on: https://chromium-review.googlesource.com/752981
Commit-Queue: Trent Apted <[email protected]>
Reviewed-by: Robert Sesek <[email protected]>
Cr-Commit-Position: refs/heads/master@{#515338}
2 files changed