| 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/download/download_service.h" | 5 #include "chrome/browser/download/download_service.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 9 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 10 #include "chrome/browser/download/download_history.h" | 10 #include "chrome/browser/download/download_history.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 manager_delegate_->GetDownloadIdReceiverCallback()); | 59 manager_delegate_->GetDownloadIdReceiverCallback()); |
| 60 download_history_.reset(new DownloadHistory( | 60 download_history_.reset(new DownloadHistory( |
| 61 manager, | 61 manager, |
| 62 scoped_ptr<DownloadHistory::HistoryAdapter>( | 62 scoped_ptr<DownloadHistory::HistoryAdapter>( |
| 63 new DownloadHistory::HistoryAdapter(history)))); | 63 new DownloadHistory::HistoryAdapter(history)))); |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Pass an empty delegate when constructing the DownloadUIController. The | 66 // Pass an empty delegate when constructing the DownloadUIController. The |
| 67 // default delegate does all the notifications we need. | 67 // default delegate does all the notifications we need. |
| 68 scoped_ptr<DownloadUIController::Delegate> empty_ui_delegate; | 68 scoped_ptr<DownloadUIController::Delegate> empty_ui_delegate; |
| 69 download_ui_.reset(new DownloadUIController(manager, | 69 download_ui_.reset(new DownloadUIController( |
| 70 empty_ui_delegate.Pass())); | 70 manager, |
| 71 DownloadUIController::NewDownloadFilterFromDownloadHistory( |
| 72 download_history_.get()), |
| 73 empty_ui_delegate.Pass())); |
| 71 | 74 |
| 72 // Include this download manager in the set monitored by the | 75 // Include this download manager in the set monitored by the |
| 73 // global status updater. | 76 // global status updater. |
| 74 g_browser_process->download_status_updater()->AddManager(manager); | 77 g_browser_process->download_status_updater()->AddManager(manager); |
| 75 | 78 |
| 76 return manager_delegate_.get(); | 79 return manager_delegate_.get(); |
| 77 } | 80 } |
| 78 | 81 |
| 79 DownloadHistory* DownloadService::GetDownloadHistory() { | 82 DownloadHistory* DownloadService::GetDownloadHistory() { |
| 80 if (!download_manager_created_) { | 83 if (!download_manager_created_) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // code) when the DownloadManager is shutting down. So we shut it down | 164 // code) when the DownloadManager is shutting down. So we shut it down |
| 162 // manually earlier. See http://crbug.com/131692 | 165 // manually earlier. See http://crbug.com/131692 |
| 163 BrowserContext::GetDownloadManager(profile_)->Shutdown(); | 166 BrowserContext::GetDownloadManager(profile_)->Shutdown(); |
| 164 } | 167 } |
| 165 #if !defined(OS_ANDROID) | 168 #if !defined(OS_ANDROID) |
| 166 extension_event_router_.reset(); | 169 extension_event_router_.reset(); |
| 167 #endif | 170 #endif |
| 168 manager_delegate_.reset(); | 171 manager_delegate_.reset(); |
| 169 download_history_.reset(); | 172 download_history_.reset(); |
| 170 } | 173 } |
| OLD | NEW |