Index: chrome/browser/lifetime/application_lifetime.cc |
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc |
index 0693c58f08a7e48398ecbaeee2248f5ba129c73d..d4e9e3b922990fbf345e9c875201c0474b76324d 100644 |
--- a/chrome/browser/lifetime/application_lifetime.cc |
+++ b/chrome/browser/lifetime/application_lifetime.cc |
@@ -95,13 +95,18 @@ void AttemptExitInternal() { |
g_browser_process->platform_part()->AttemptExit(); |
} |
+void CloseAllBrowsersAndQuit() { |
+ browser_shutdown::SetTryingToQuit(true); |
+ CloseAllBrowsers(); |
+} |
+ |
void CloseAllBrowsers() { |
- // If there are no browsers, send the APP_TERMINATING action here. Otherwise, |
- // it will be sent by RemoveBrowser() when the last browser has closed. |
+ // If there are no browsers and closing the last browser would quit the |
+ // application, send the APP_TERMINATING action here. Otherwise, it will be |
+ // sent by RemoveBrowser() when the last browser has closed. |
if (browser_shutdown::ShuttingDownWithoutClosingBrowsers() || |
- chrome::GetTotalBrowserCount() == 0) { |
- // Tell everyone that we are shutting down. |
- browser_shutdown::SetTryingToQuit(true); |
+ (chrome::GetTotalBrowserCount() == 0 && |
+ (browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive()))) { |
benwells
2013/10/21 05:57:22
Why did the SetTryingToQuit(true) line get removed
Sam McNally
2013/10/21 06:45:35
Done.
benwells
2013/10/21 21:12:51
Sorry, I'm probably being dense here but why don't
|
#if defined(ENABLE_SESSION_SERVICE) |
// If ShuttingDownWithoutClosingBrowsers() returns true, the session |
@@ -172,6 +177,9 @@ void StartShutdownTracing() { |
// The Android implementation is in application_lifetime_android.cc |
#if !defined(OS_ANDROID) |
void AttemptRestart() { |
+ // Tell everyone that we are shutting down. |
+ browser_shutdown::SetTryingToQuit(true); |
+ |
// TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead? |
for (chrome::BrowserIterator it; !it.done(); it.Next()) |
content::BrowserContext::SaveSessionState(it->profile()); |
@@ -203,6 +211,9 @@ void AttemptRestartWithModeSwitch() { |
#endif |
void AttemptExit() { |
+ // Tell everyone that we are shutting down. |
+ browser_shutdown::SetTryingToQuit(true); |
+ |
// If we know that all browsers can be closed without blocking, |
// don't notify users of crashes beyond this point. |
// Note that MarkAsCleanShutdown() does not set UMA's exit cleanly bit |
@@ -222,6 +233,9 @@ void ExitCleanly() { |
// chrome in 3 seconds after SIGTERM. |
g_browser_process->EndSession(); |
+ // Tell everyone that we are shutting down. |
+ browser_shutdown::SetTryingToQuit(true); |
+ |
// Don't block when SIGTERM is received. AreaAllBrowsersCloseable() |
// can be false in following cases. a) power-off b) signout from |
// screen locker. |