| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 // Returns true if all browsers can be closed without user interaction. | 54 // 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 | 55 // This currently checks if there is pending download, or if it needs to |
| 56 // handle unload handler. | 56 // handle unload handler. |
| 57 bool AreAllBrowsersCloseable() { | 57 bool AreAllBrowsersCloseable() { |
| 58 chrome::BrowserIterator browser_it; | 58 chrome::BrowserIterator browser_it; |
| 59 if (browser_it.done()) | 59 if (browser_it.done()) |
| 60 return true; | 60 return true; |
| 61 | 61 |
| 62 // If there are any downloads active, all browsers are not closeable. | 62 // If there are any downloads active, all browsers are not closeable. |
| 63 if (DownloadService::DownloadCountAllProfiles() > 0) | 63 // However, this does not block for malicious downloads. |
| 64 if (DownloadService::NonMaliciousDownloadCountAllProfiles() > 0) |
| 64 return false; | 65 return false; |
| 65 | 66 |
| 66 // Check TabsNeedBeforeUnloadFired(). | 67 // Check TabsNeedBeforeUnloadFired(). |
| 67 for (; !browser_it.done(); browser_it.Next()) { | 68 for (; !browser_it.done(); browser_it.Next()) { |
| 68 if (browser_it->TabsNeedBeforeUnloadFired()) | 69 if (browser_it->TabsNeedBeforeUnloadFired()) |
| 69 return false; | 70 return false; |
| 70 } | 71 } |
| 71 return true; | 72 return true; |
| 72 } | 73 } |
| 73 | 74 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 // environment is still active. | 380 // environment is still active. |
| 380 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) | 381 if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_NATIVE) |
| 381 return !ash::Shell::HasInstance(); | 382 return !ash::Shell::HasInstance(); |
| 382 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) | 383 else if (browser->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 383 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); | 384 return BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE)->empty(); |
| 384 #endif | 385 #endif |
| 385 return true; | 386 return true; |
| 386 } | 387 } |
| 387 | 388 |
| 388 } // namespace chrome | 389 } // namespace chrome |
| OLD | NEW |