| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/lifetime/application_lifetime.h" | 5 #include "chrome/browser/lifetime/application_lifetime.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 void CloseAllBrowsersAndQuit() { | 107 void CloseAllBrowsersAndQuit() { |
| 108 browser_shutdown::SetTryingToQuit(true); | 108 browser_shutdown::SetTryingToQuit(true); |
| 109 CloseAllBrowsers(); | 109 CloseAllBrowsers(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void CloseAllBrowsers() { | 112 void CloseAllBrowsers() { |
| 113 // If there are no browsers and closing the last browser would quit the | 113 // If there are no browsers and closing the last browser would quit the |
| 114 // application, send the APP_TERMINATING action here. Otherwise, it will be | 114 // application, send the APP_TERMINATING action here. Otherwise, it will be |
| 115 // sent by RemoveBrowser() when the last browser has closed. | 115 // sent by RemoveBrowser() when the last browser has closed. |
| 116 if (browser_shutdown::ShuttingDownWithoutClosingBrowsers() || | 116 if (chrome::GetTotalBrowserCount() == 0 && |
| 117 (chrome::GetTotalBrowserCount() == 0 && | 117 (browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive())) { |
| 118 (browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive()))) { | |
| 119 // Tell everyone that we are shutting down. | 118 // Tell everyone that we are shutting down. |
| 120 browser_shutdown::SetTryingToQuit(true); | 119 browser_shutdown::SetTryingToQuit(true); |
| 121 | 120 |
| 122 #if defined(ENABLE_SESSION_SERVICE) | 121 #if defined(ENABLE_SESSION_SERVICE) |
| 123 // If ShuttingDownWithoutClosingBrowsers() returns true, the session | 122 // If ShuttingDownWithoutClosingBrowsers() returns true, the session |
| 124 // services may not get a chance to shut down normally, so explicitly shut | 123 // services may not get a chance to shut down normally, so explicitly shut |
| 125 // them down here to ensure they have a chance to persist their data. | 124 // them down here to ensure they have a chance to persist their data. |
| 126 ProfileManager::ShutdownSessionServices(); | 125 ProfileManager::ShutdownSessionServices(); |
| 127 #endif | 126 #endif |
| 128 | 127 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 // environment is still active. | 396 // environment is still active. |
| 398 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) | 397 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) |
| 399 return !ash::Shell::HasInstance(); | 398 return !ash::Shell::HasInstance(); |
| 400 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) | 399 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 401 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); | 400 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); |
| 402 #endif | 401 #endif |
| 403 return true; | 402 return true; |
| 404 } | 403 } |
| 405 | 404 |
| 406 } // namespace chrome | 405 } // namespace chrome |
| OLD | NEW |