Chromium Code Reviews| Index: chrome/browser/ui/browser_list.cc |
| diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc |
| index be11579dd2359840435112537ac8179c225e8e87..22ebf369f74d4ea884e32fa5fa9ee90898b989c8 100644 |
| --- a/chrome/browser/ui/browser_list.cc |
| +++ b/chrome/browser/ui/browser_list.cc |
| @@ -10,6 +10,7 @@ |
| #include "build/build_config.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/browser_shutdown.h" |
| +#include "chrome/browser/download/download_service.h" |
| #include "chrome/browser/metrics/thread_watcher.h" |
| #include "chrome/browser/prefs/pref_service.h" |
| #include "chrome/browser/printing/background_printing_manager.h" |
| @@ -187,15 +188,17 @@ printing::BackgroundPrintingManager* GetBackgroundPrintingManager() { |
| // This currently checks if there is pending download, or if it needs to |
| // handle unload handler. |
| bool AreAllBrowsersCloseable() { |
| - for (BrowserList::const_iterator i = BrowserList::begin(); |
| - i != BrowserList::end(); ++i) { |
| - bool normal_downloads_are_present = false; |
| - bool incognito_downloads_are_present = false; |
| - (*i)->CheckDownloadsInProgress(&normal_downloads_are_present, |
| - &incognito_downloads_are_present); |
| - if (normal_downloads_are_present || |
| - incognito_downloads_are_present || |
| - (*i)->TabsNeedBeforeUnloadFired()) |
| + BrowserList::const_iterator browser_it = BrowserList::begin(); |
| + if (browser_it == BrowserList::end()) |
|
achuithb
2011/10/13 23:05:08
Is this condition necessary? I believe the code sh
Randy Smith (Not in Mondays)
2011/10/14 00:37:41
It's pedantic, but I don't think so. If there are
achuithb
2011/10/14 19:22:10
Ok.
|
| + return true; |
| + |
| + // If there are any downloads active, all browsers are not closeable. |
| + if (DownloadService::TotalDownloadCount() > 0) |
| + return false; |
| + |
| + // Check TabsNeedBeforeUnloadFired(). |
| + for (; browser_it != BrowserList::end(); ++browser_it) { |
| + if ((*browser_it)->TabsNeedBeforeUnloadFired()) |
| return false; |
| } |
| return true; |