| 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 <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| 11 #include <windows.h> | 11 #include <windows.h> |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #include "base/bind.h" | 14 #include "base/bind.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 17 #include "base/process/process.h" | 17 #include "base/process/process.h" |
| 18 #include "base/process/process_handle.h" | 18 #include "base/process/process_handle.h" |
| 19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 20 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
| 21 #include "chrome/browser/browser_process_platform_part.h" | 21 #include "chrome/browser/browser_process_platform_part.h" |
| 22 #include "chrome/browser/browser_shutdown.h" | 22 #include "chrome/browser/browser_shutdown.h" |
| 23 #include "chrome/browser/chrome_notification_types.h" | 23 #include "chrome/browser/chrome_notification_types.h" |
| 24 #include "chrome/browser/download/download_service.h" | 24 #include "chrome/browser/download/download_core_service.h" |
| 25 #include "chrome/browser/lifetime/browser_close_manager.h" | 25 #include "chrome/browser/lifetime/browser_close_manager.h" |
| 26 #include "chrome/browser/lifetime/keep_alive_registry.h" | 26 #include "chrome/browser/lifetime/keep_alive_registry.h" |
| 27 #include "chrome/browser/metrics/thread_watcher.h" | 27 #include "chrome/browser/metrics/thread_watcher.h" |
| 28 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
| 29 #include "chrome/browser/profiles/profile_manager.h" | 29 #include "chrome/browser/profiles/profile_manager.h" |
| 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 31 #include "chrome/browser/ui/user_manager.h" | 31 #include "chrome/browser/ui/user_manager.h" |
| 32 #include "chrome/common/chrome_constants.h" | 32 #include "chrome/common/chrome_constants.h" |
| 33 #include "chrome/common/features.h" | 33 #include "chrome/common/features.h" |
| 34 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 65 #if !defined(OS_ANDROID) | 65 #if !defined(OS_ANDROID) |
| 66 // Returns true if all browsers can be closed without user interaction. | 66 // Returns true if all browsers can be closed without user interaction. |
| 67 // This currently checks if there is pending download, or if it needs to | 67 // This currently checks if there is pending download, or if it needs to |
| 68 // handle unload handler. | 68 // handle unload handler. |
| 69 bool AreAllBrowsersCloseable() { | 69 bool AreAllBrowsersCloseable() { |
| 70 if (BrowserList::GetInstance()->empty()) | 70 if (BrowserList::GetInstance()->empty()) |
| 71 return true; | 71 return true; |
| 72 | 72 |
| 73 // If there are any downloads active, all browsers are not closeable. | 73 // If there are any downloads active, all browsers are not closeable. |
| 74 // However, this does not block for malicious downloads. | 74 // However, this does not block for malicious downloads. |
| 75 if (DownloadService::NonMaliciousDownloadCountAllProfiles() > 0) | 75 if (DownloadCoreService::NonMaliciousDownloadCountAllProfiles() > 0) |
| 76 return false; | 76 return false; |
| 77 | 77 |
| 78 // Check TabsNeedBeforeUnloadFired(). | 78 // Check TabsNeedBeforeUnloadFired(). |
| 79 for (auto* browser : *BrowserList::GetInstance()) { | 79 for (auto* browser : *BrowserList::GetInstance()) { |
| 80 if (browser->TabsNeedBeforeUnloadFired()) | 80 if (browser->TabsNeedBeforeUnloadFired()) |
| 81 return false; | 81 return false; |
| 82 } | 82 } |
| 83 return true; | 83 return true; |
| 84 } | 84 } |
| 85 #endif // !defined(OS_ANDROID) | 85 #endif // !defined(OS_ANDROID) |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 void OnAppExiting() { | 376 void OnAppExiting() { |
| 377 static bool notified = false; | 377 static bool notified = false; |
| 378 if (notified) | 378 if (notified) |
| 379 return; | 379 return; |
| 380 notified = true; | 380 notified = true; |
| 381 HandleAppExitingForPlatform(); | 381 HandleAppExitingForPlatform(); |
| 382 } | 382 } |
| 383 #endif // !defined(OS_ANDROID) | 383 #endif // !defined(OS_ANDROID) |
| 384 | 384 |
| 385 } // namespace chrome | 385 } // namespace chrome |
| OLD | NEW |