| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/browser_list.h" | 5 #include "chrome/browser/ui/browser_list.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } | 177 } |
| 178 | 178 |
| 179 printing::BackgroundPrintingManager* GetBackgroundPrintingManager() { | 179 printing::BackgroundPrintingManager* GetBackgroundPrintingManager() { |
| 180 return g_browser_process->background_printing_manager(); | 180 return g_browser_process->background_printing_manager(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 // Returns true if all browsers can be closed without user interaction. | 183 // Returns true if all browsers can be closed without user interaction. |
| 184 // This currently checks if there is pending download, or if it needs to | 184 // This currently checks if there is pending download, or if it needs to |
| 185 // handle unload handler. | 185 // handle unload handler. |
| 186 bool AreAllBrowsersCloseable() { | 186 bool AreAllBrowsersCloseable() { |
| 187 for (BrowserList::const_iterator i = BrowserList::begin(); | 187 BrowserList::const_iterator browser_it = BrowserList::begin(); |
| 188 i != BrowserList::end(); ++i) { | 188 if (browser_it == BrowserList::end()) |
| 189 bool normal_downloads_are_present = false; | 189 return true; |
| 190 bool incognito_downloads_are_present = false; | 190 |
| 191 (*i)->CheckDownloadsInProgress(&normal_downloads_are_present, | 191 // If there are any downloads active, all browsers are not closeable. |
| 192 &incognito_downloads_are_present); | 192 if (g_browser_process->profile_manager()->TotalDownloadCount() > 0) |
| 193 if (normal_downloads_are_present || | 193 return false; |
| 194 incognito_downloads_are_present || | 194 |
| 195 (*i)->TabsNeedBeforeUnloadFired()) | 195 // Check TabsNeedBeforeUnloadFired(). |
| 196 for (; browser_it != BrowserList::end(); ++browser_it) { |
| 197 if ((*browser_it)->TabsNeedBeforeUnloadFired()) |
| 196 return false; | 198 return false; |
| 197 } | 199 } |
| 198 return true; | 200 return true; |
| 199 } | 201 } |
| 200 | 202 |
| 201 #if defined(OS_CHROMEOS) | 203 #if defined(OS_CHROMEOS) |
| 202 | 204 |
| 203 bool signout = false; | 205 bool signout = false; |
| 204 | 206 |
| 205 // Fast shutdown for ChromeOS. It tells session manager to start | 207 // Fast shutdown for ChromeOS. It tells session manager to start |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 // If no more TabContents from Browsers, check the BackgroundPrintingManager. | 745 // If no more TabContents from Browsers, check the BackgroundPrintingManager. |
| 744 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { | 746 while (bg_printing_iterator_ != GetBackgroundPrintingManager()->end()) { |
| 745 cur_ = *bg_printing_iterator_; | 747 cur_ = *bg_printing_iterator_; |
| 746 CHECK(cur_); | 748 CHECK(cur_); |
| 747 ++bg_printing_iterator_; | 749 ++bg_printing_iterator_; |
| 748 return; | 750 return; |
| 749 } | 751 } |
| 750 // Reached the end - no more TabContents. | 752 // Reached the end - no more TabContents. |
| 751 cur_ = NULL; | 753 cur_ = NULL; |
| 752 } | 754 } |
| OLD | NEW |