| Index: chrome/browser/ui/browser_list.cc
|
| diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc
|
| index ac7aa303120eb902b7a7bc582ae5adb8d616d790..d6f0679f6a4b79f04f1b490ee8ed1b339016c2b5 100644
|
| --- a/chrome/browser/ui/browser_list.cc
|
| +++ b/chrome/browser/ui/browser_list.cc
|
| @@ -184,15 +184,21 @@ 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())
|
| + return true;
|
| +
|
| + // If there are any downloads active, all browsers are not closeable.
|
| + int total_download_count = 0;
|
| + int profile_download_count = 0;
|
| + (*browser_it)->CheckDownloadsInProgress(&total_download_count,
|
| + &profile_download_count);
|
| + if (total_download_count > 0)
|
| + return false;
|
| +
|
| + // Check TabsNeedBeforeUnloadFired().
|
| + for (; browser_it != BrowserList::end(); ++browser_it) {
|
| + if ((*browser_it)->TabsNeedBeforeUnloadFired())
|
| return false;
|
| }
|
| return true;
|
|
|