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/common | |
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/common')
-rw-r--r-- | chrome/common/chrome_switches.cc | 3 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 | ||||
-rw-r--r-- | chrome/common/notification_type.h | 18 |
3 files changed, 16 insertions, 6 deletions
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index ccef475..3c4255a 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -564,6 +564,9 @@ const char kIssue35198Permission[] = "issue35198-permission"; // Specifies the flags passed to JS engine const char kJavaScriptFlags[] = "js-flags"; +// Used for testing - keeps browser alive after last browser window closes. +const char kKeepAliveForTest[] = "keep-alive-for-test"; + // Load an extension from the specified directory. const char kLoadExtension[] = "load-extension"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index ecc92fb..70a8268 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -170,6 +170,7 @@ extern const char kIssue35198CrxDirBrowser[]; extern const char kIssue35198ExtraLogging[]; extern const char kIssue35198Permission[]; extern const char kJavaScriptFlags[]; +extern const char kKeepAliveForTest[]; extern const char kLoadExtension[]; extern const char kLoadPlugin[]; extern const char kExtraPluginDir[]; diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h index bf0d053..1bafff6 100644 --- a/chrome/common/notification_type.h +++ b/chrome/common/notification_type.h @@ -198,10 +198,11 @@ class NotificationType { // This message is sent after a window has been closed. The source is a // Source<Browser> containing the affected Browser. Details is a boolean - // that if true indicates that the application will be closed as a result of - // this browser window closure (i.e. this was the last opened browser - // window on win/linux). Note that the boolean pointed to by details is - // only valid for the duration of this call. + // that if true indicates that the last browser window has closed - this + // does not indicate that the application is exiting (observers should + // listen for APP_TERMINATING if they want to detect when the application + // will shut down). Note that the boolean pointed to by details is only + // valid for the duration of this call. BROWSER_CLOSED, // This message is sent when the last window considered to be an @@ -214,11 +215,16 @@ class NotificationType { // This message is sent when the application is made active (Mac OS X only // at present). No source or details are passed. APP_ACTIVATED, +#endif - // This message is sent when the application is terminating (Mac OS X only - // at present). No source or details are passed. + // This message is sent when the application is terminating (the last + // browser window has shutdown as part of an explicit user-initiated exit, + // or the user closed the last browser window on Windows/Linux and there are + // no BackgroundContents keeping the browser running). No source or details + // are passed. APP_TERMINATING, +#if defined(OS_MACOSX) // This notification is sent when the app has no key window, such as when // all windows are closed but the app is still active. No source or details // are provided. |