diff options
author | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-20 20:52:20 +0000 |
---|---|---|
committer | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-20 20:52:20 +0000 |
commit | c984d9f8b393418f26c8a3a90ceaff17f2d421af (patch) | |
tree | 1e6d691629226bee23228b87b435957a01587c82 /chrome/browser/browser_shutdown.h | |
parent | a82ac135a3453615f7289b5fbacc512576858639 (diff) | |
download | chromium_src-c984d9f8b393418f26c8a3a90ceaff17f2d421af.zip chromium_src-c984d9f8b393418f26c8a3a90ceaff17f2d421af.tar.gz chromium_src-c984d9f8b393418f26c8a3a90ceaff17f2d421af.tar.bz2 |
Moved code that generates APP_TERMINATING notification into BrowserList so it can be used on all platforms. Updated observers (ExtensionProcessManager,
BackgroundContents) to listen for APP_TERMINATING instead of listening for
BROWSER_CLOSED on some platforms.
APP_TERMINATING is now sent just before the main message loop exits rather than just after, but no code depends on this timing.
Updated Mac code to always call BrowserList::CloseAllBrowsers() even if there
are no open browsers, to ensure that APP_TERMINATING is always fired.
Changed BackgroundContentsService to keep the browser process alive when there
are BackgroundContents running and updated the unit tests.
Renamed BrowserList::IsInPersistentMode() => WillShutdownWhenLastBrowserCloses() and AllBrowsersClosed() => AllBrowsersClosedAndAppExiting() to more precisely indicate their true functions.
Exposed BrowserProcess::ModuleRefCount() so BrowserList can determine when the application is going to exit so the right notifications/callbacks can be generated.
Updated background-auto-update-restart code to use new BrowserList APIs to determine whether the application is running "in the background".
Added code to cancel shutdown on all plaforms if the user selects cancel in an onbeforeunload dialog.
BUG=45275
TEST=RunInBackgroundTest (ui_test)
Review URL: http://codereview.chromium.org/2866034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_shutdown.h')
-rw-r--r-- | chrome/browser/browser_shutdown.h | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/chrome/browser/browser_shutdown.h b/chrome/browser/browser_shutdown.h index 3ab2c2e..c782f36 100644 --- a/chrome/browser/browser_shutdown.h +++ b/chrome/browser/browser_shutdown.h @@ -44,21 +44,26 @@ void Shutdown(); // Called at startup to create a histogram from our previous shutdown time. void ReadLastShutdownInfo(); -#if defined(OS_MACOSX) -// On Mac, closing the last window does not automatically quit the application. -// To actually quit, set a flag which makes final window closure trigger a quit. -// If the quit is aborted, then the flag should be reset (but see notes below on -// the proper way to do this, i.e., usually not using |SetTryingToQuit()|). +// There are various situations where the browser process should continue to +// run after the last browser window has closed - the Mac always continues +// running until the user explicitly quits, and on Windows/Linux the application +// should not shutdown when the last browser window closes if there are any +// BackgroundContents running. +// When the user explicitly chooses to shutdown the app (via the "Exit" or +// "Quit" menu items) BrowserList will call SetTryingToQuit() to tell itself to +// initiate a shutdown when the last window closes. +// If the quit is aborted, then the flag should be reset. -// This is a low-level mutator; in general, don't call it, except from -// appropriate places in the app controller. To quit, use usual means, e.g., -// using |chrome_browser_application_mac::Terminate()|. To stop quitting, use -// |chrome_browser_application_mac::CancelTerminate()|. +// This is a low-level mutator; in general, don't call SetTryingToQuit(true), +// except from appropriate places in BrowserList. To quit, use usual means, +// e.g., using |chrome_browser_application_mac::Terminate()| on the Mac, or +// |BrowserList::CloseAllWindowsAndExit()| on other platforms. To stop quitting, +// use |chrome_browser_application_mac::CancelTerminate()| on the Mac; other +// platforms can call SetTryingToQuit(false) directly. void SetTryingToQuit(bool quitting); // General accessor. bool IsTryingToQuit(); -#endif // OS_MACOSX } // namespace browser_shutdown |