[Mac] Do not let apps keep Chrome alive if shutting down.
commitf60ef51534ed50361020392ed74435cfa7d6e311
authorjackhou <jackhou@chromium.org>
Tue, 13 Jan 2015 04:51:41 +0000 (12 20:51 -0800)
committerCommit bot <commit-bot@chromium.org>
Tue, 13 Jan 2015 04:52:18 +0000 (13 04:52 +0000)
treef73a5e8fe7d93a58168800001f45aea22c6ce749
parentc998ca372838d0b700c87dd8eda905ab2d1260df
[Mac] Do not let apps keep Chrome alive if shutting down.

If the user quits Chrome while Chrome Apps are running, we keep Chrome running
in the background and show a notification.

When Chrome is terminated because the system is shutting down or the user is
logging off, we should make sure Chrome terminates regardless of any running apps.

This CL detects whether an [NSApplication terminate:] is due to shutdown or log off
by listening for NSWorkspaceWillPowerOffNotification. This notification is only
received if Chrome is about to be terminated, i.e. we do not receive the notification
if another app prevented shutdown.

BUG=442280

Review URL: https://codereview.chromium.org/831813003

Cr-Commit-Position: refs/heads/master@{#311215}
chrome/browser/app_controller_mac.h
chrome/browser/app_controller_mac.mm
chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac_interactive_uitest.mm [moved from chrome/browser/ui/cocoa/apps/quit_with_apps_controller_mac_interactive_uitest.cc with 83% similarity]
chrome/chrome_tests.gypi