| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // there is nothing to do. | 311 // there is nothing to do. |
| 312 if (!g_browser_process) return; | 312 if (!g_browser_process) return; |
| 313 | 313 |
| 314 // Allow the app to shutdown again. | 314 // Allow the app to shutdown again. |
| 315 if (!WillKeepAlive()) { | 315 if (!WillKeepAlive()) { |
| 316 g_browser_process->ReleaseModule(); | 316 g_browser_process->ReleaseModule(); |
| 317 // If there are no browsers open and we aren't already shutting down, | 317 // If there are no browsers open and we aren't already shutting down, |
| 318 // initiate a shutdown. Also skips shutdown if this is a unit test | 318 // initiate a shutdown. Also skips shutdown if this is a unit test |
| 319 // (MessageLoop::current() == null). | 319 // (MessageLoop::current() == null). |
| 320 if (chrome::GetTotalBrowserCount() == 0 && | 320 if (chrome::GetTotalBrowserCount() == 0 && |
| 321 !browser_shutdown::IsTryingToQuit() && | 321 !browser_shutdown::IsTryingToQuit() && base::MessageLoop::current()) { |
| 322 MessageLoop::current()) { | |
| 323 CloseAllBrowsers(); | 322 CloseAllBrowsers(); |
| 324 } | 323 } |
| 325 } | 324 } |
| 326 } | 325 } |
| 327 | 326 |
| 328 bool WillKeepAlive() { | 327 bool WillKeepAlive() { |
| 329 return g_keep_alive_count > 0; | 328 return g_keep_alive_count > 0; |
| 330 } | 329 } |
| 331 | 330 |
| 332 void NotifyAppTerminating() { | 331 void NotifyAppTerminating() { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 chrome::HostDesktopType other_desktop = | 393 chrome::HostDesktopType other_desktop = |
| 395 (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE ? | 394 (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE ? |
| 396 chrome::HOST_DESKTOP_TYPE_ASH : chrome::HOST_DESKTOP_TYPE_NATIVE); | 395 chrome::HOST_DESKTOP_TYPE_ASH : chrome::HOST_DESKTOP_TYPE_NATIVE); |
| 397 if (!BrowserList::GetInstance(other_desktop)->empty()) | 396 if (!BrowserList::GetInstance(other_desktop)->empty()) |
| 398 return false; | 397 return false; |
| 399 #endif | 398 #endif |
| 400 return true; | 399 return true; |
| 401 } | 400 } |
| 402 | 401 |
| 403 } // namespace chrome | 402 } // namespace chrome |
| OLD | NEW |