| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 if (!g_browser_process) return; | 295 if (!g_browser_process) return; |
| 296 | 296 |
| 297 // Allow the app to shutdown again. | 297 // Allow the app to shutdown again. |
| 298 if (!WillKeepAlive()) { | 298 if (!WillKeepAlive()) { |
| 299 g_browser_process->ReleaseModule(); | 299 g_browser_process->ReleaseModule(); |
| 300 // If there are no browsers open and we aren't already shutting down, | 300 // If there are no browsers open and we aren't already shutting down, |
| 301 // initiate a shutdown. Also skips shutdown if this is a unit test | 301 // initiate a shutdown. Also skips shutdown if this is a unit test |
| 302 // (MessageLoop::current() == null). | 302 // (MessageLoop::current() == null). |
| 303 if (chrome::GetTotalBrowserCount() == 0 && | 303 if (chrome::GetTotalBrowserCount() == 0 && |
| 304 !browser_shutdown::IsTryingToQuit() && | 304 !browser_shutdown::IsTryingToQuit() && |
| 305 MessageLoop::current()) { | 305 base::MessageLoop::current()) { |
| 306 CloseAllBrowsers(); | 306 CloseAllBrowsers(); |
| 307 } | 307 } |
| 308 } | 308 } |
| 309 } | 309 } |
| 310 | 310 |
| 311 bool WillKeepAlive() { | 311 bool WillKeepAlive() { |
| 312 return g_keep_alive_count > 0; | 312 return g_keep_alive_count > 0; |
| 313 } | 313 } |
| 314 | 314 |
| 315 void NotifyAppTerminating() { | 315 void NotifyAppTerminating() { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 // environment is still active. | 380 // environment is still active. |
| 381 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) | 381 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) |
| 382 return !ash::Shell::HasInstance(); | 382 return !ash::Shell::HasInstance(); |
| 383 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) | 383 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 384 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); | 384 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); |
| 385 #endif | 385 #endif |
| 386 return true; | 386 return true; |
| 387 } | 387 } |
| 388 | 388 |
| 389 } // namespace chrome | 389 } // namespace chrome |
| OLD | NEW |