This PR adds an API enabling Electron to set itself as the default
protocol handler for a custom porotocl on both oS X and Windows.
For details, please see `docs/app.md`.
Closes#4857
OS X's application termination doesn't work very well with C++ message
loops. Especially when we return NSTerminateLater for shouldTerminate,
it would be impossible for the C++ message loop to quit, because unless
we explictly let NSApp terminate the application, the message loop would
think the application is not terminated and will run forever.
The fix is to simply ignore the Cocoa's application termination request
and let the C++ message loop deal with it compeletey. But we had the
side effect that atom-shell would always cancel OS X's shutdown request,
this is also the approach chosen by Chromium.
Fixes#229.
Fixesatom/atom#1864.