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 (chrome::GetTotalBrowserCount() == 0 && | 116 if (browser_shutdown::ShuttingDownWithoutClosingBrowsers() || |
117 (browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive())) { | 117 (chrome::GetTotalBrowserCount() == 0 && |
| 118 (browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive()))) { |
118 // Tell everyone that we are shutting down. | 119 // Tell everyone that we are shutting down. |
119 browser_shutdown::SetTryingToQuit(true); | 120 browser_shutdown::SetTryingToQuit(true); |
120 | 121 |
121 #if defined(ENABLE_SESSION_SERVICE) | 122 #if defined(ENABLE_SESSION_SERVICE) |
122 // If ShuttingDownWithoutClosingBrowsers() returns true, the session | 123 // If ShuttingDownWithoutClosingBrowsers() returns true, the session |
123 // services may not get a chance to shut down normally, so explicitly shut | 124 // services may not get a chance to shut down normally, so explicitly shut |
124 // them down here to ensure they have a chance to persist their data. | 125 // them down here to ensure they have a chance to persist their data. |
125 ProfileManager::ShutdownSessionServices(); | 126 ProfileManager::ShutdownSessionServices(); |
126 #endif | 127 #endif |
127 | 128 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 // environment is still active. | 397 // environment is still active. |
397 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) | 398 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) |
398 return !ash::Shell::HasInstance(); | 399 return !ash::Shell::HasInstance(); |
399 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) | 400 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
400 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); | 401 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); |
401 #endif | 402 #endif |
402 return true; | 403 return true; |
403 } | 404 } |
404 | 405 |
405 } // namespace chrome | 406 } // namespace chrome |
OLD | NEW |