| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "chromeos/dbus/update_engine_client.h" | 44 #include "chromeos/dbus/update_engine_client.h" |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 #if defined(OS_WIN) | 47 #if defined(OS_WIN) |
| 48 #include "base/win/win_util.h" | 48 #include "base/win/win_util.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 namespace chrome { | 51 namespace chrome { |
| 52 namespace { | 52 namespace { |
| 53 | 53 |
| 54 #if !defined(OS_ANDROID) |
| 54 // Returns true if all browsers can be closed without user interaction. | 55 // Returns true if all browsers can be closed without user interaction. |
| 55 // This currently checks if there is pending download, or if it needs to | 56 // This currently checks if there is pending download, or if it needs to |
| 56 // handle unload handler. | 57 // handle unload handler. |
| 57 bool AreAllBrowsersCloseable() { | 58 bool AreAllBrowsersCloseable() { |
| 58 chrome::BrowserIterator browser_it; | 59 chrome::BrowserIterator browser_it; |
| 59 if (browser_it.done()) | 60 if (browser_it.done()) |
| 60 return true; | 61 return true; |
| 61 | 62 |
| 62 // If there are any downloads active, all browsers are not closeable. | 63 // If there are any downloads active, all browsers are not closeable. |
| 63 // However, this does not block for malicious downloads. | 64 // However, this does not block for malicious downloads. |
| 64 if (DownloadService::NonMaliciousDownloadCountAllProfiles() > 0) | 65 if (DownloadService::NonMaliciousDownloadCountAllProfiles() > 0) |
| 65 return false; | 66 return false; |
| 66 | 67 |
| 67 // Check TabsNeedBeforeUnloadFired(). | 68 // Check TabsNeedBeforeUnloadFired(). |
| 68 for (; !browser_it.done(); browser_it.Next()) { | 69 for (; !browser_it.done(); browser_it.Next()) { |
| 69 if (browser_it->TabsNeedBeforeUnloadFired()) | 70 if (browser_it->TabsNeedBeforeUnloadFired()) |
| 70 return false; | 71 return false; |
| 71 } | 72 } |
| 72 return true; | 73 return true; |
| 73 } | 74 } |
| 75 #endif // !defined(OS_ANDROID) |
| 74 | 76 |
| 75 int g_keep_alive_count = 0; | 77 int g_keep_alive_count = 0; |
| 76 | 78 |
| 77 #if defined(OS_CHROMEOS) | 79 #if defined(OS_CHROMEOS) |
| 78 // Whether a session manager requested to shutdown. | 80 // Whether a session manager requested to shutdown. |
| 79 bool g_session_manager_requested_shutdown = true; | 81 bool g_session_manager_requested_shutdown = true; |
| 80 #endif | 82 #endif |
| 81 | 83 |
| 82 } // namespace | 84 } // namespace |
| 83 | 85 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 // environment is still active. | 387 // environment is still active. |
| 386 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) | 388 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) |
| 387 return !ash::Shell::HasInstance(); | 389 return !ash::Shell::HasInstance(); |
| 388 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) | 390 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 389 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); | 391 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); |
| 390 #endif | 392 #endif |
| 391 return true; | 393 return true; |
| 392 } | 394 } |
| 393 | 395 |
| 394 } // namespace chrome | 396 } // namespace chrome |
| OLD | NEW |