| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser_close_manager.h" | 5 #include "chrome/browser/lifetime/browser_close_manager.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/background/background_mode_manager.h" | 8 #include "chrome/browser/background/background_mode_manager.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/browser_shutdown.h" | 10 #include "chrome/browser/browser_shutdown.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 | 104 |
| 105 ConfirmCloseWithPendingDownloads( | 105 ConfirmCloseWithPendingDownloads( |
| 106 download_count, | 106 download_count, |
| 107 base::Bind(&BrowserCloseManager::OnReportDownloadsCancellable, this)); | 107 base::Bind(&BrowserCloseManager::OnReportDownloadsCancellable, this)); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void BrowserCloseManager::ConfirmCloseWithPendingDownloads( | 110 void BrowserCloseManager::ConfirmCloseWithPendingDownloads( |
| 111 int download_count, | 111 int download_count, |
| 112 const base::Callback<void(bool)>& callback) { | 112 const base::Callback<void(bool)>& callback) { |
| 113 Browser* browser = | 113 Browser* browser = BrowserList::GetInstance()->GetLastActive(); |
| 114 BrowserList::GetInstance(chrome::GetActiveDesktop())->GetLastActive(); | |
| 115 DCHECK(browser); | 114 DCHECK(browser); |
| 116 browser->window()->ConfirmBrowserCloseWithPendingDownloads( | 115 browser->window()->ConfirmBrowserCloseWithPendingDownloads( |
| 117 download_count, | 116 download_count, |
| 118 Browser::DOWNLOAD_CLOSE_BROWSER_SHUTDOWN, | 117 Browser::DOWNLOAD_CLOSE_BROWSER_SHUTDOWN, |
| 119 true, | 118 true, |
| 120 callback); | 119 callback); |
| 121 } | 120 } |
| 122 | 121 |
| 123 void BrowserCloseManager::OnReportDownloadsCancellable(bool proceed) { | 122 void BrowserCloseManager::OnReportDownloadsCancellable(bool proceed) { |
| 124 if (proceed) { | 123 if (proceed) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 it_ptr.reset(new chrome::BrowserIterator()); | 173 it_ptr.reset(new chrome::BrowserIterator()); |
| 175 if (!it_ptr->done() && browser == **it_ptr) { | 174 if (!it_ptr->done() && browser == **it_ptr) { |
| 176 // Destroying the browser should have removed it from the browser list. | 175 // Destroying the browser should have removed it from the browser list. |
| 177 // We should never get here. | 176 // We should never get here. |
| 178 NOTREACHED(); | 177 NOTREACHED(); |
| 179 return; | 178 return; |
| 180 } | 179 } |
| 181 } | 180 } |
| 182 } | 181 } |
| 183 } | 182 } |
| OLD | NEW |