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..54de24d15990e17ab8b4cfe6644c0257a0cae951 100644 |
--- a/chrome/browser/lifetime/application_lifetime.cc |
+++ b/chrome/browser/lifetime/application_lifetime.cc |
@@ -95,13 +95,17 @@ 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, |
benwells
2013/10/20 23:46:22
Please update this comment too, it doesn't capture
Sam McNally
2013/10/21 04:31:03
Done.
|
// 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()))) { |
#if defined(ENABLE_SESSION_SERVICE) |
// If ShuttingDownWithoutClosingBrowsers() returns true, the session |
@@ -172,6 +176,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 +210,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 +232,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. |