| 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" |
| 11 #include "chrome/browser/download/download_service_factory.h" | 11 #include "chrome/browser/download/download_service_factory.h" |
| 12 #include "chrome/browser/download/download_status_updater.h" | 12 #include "chrome/browser/download/download_status_updater.h" |
| 13 #include "chrome/browser/download/download_ui_controller.h" | 13 #include "chrome/browser/download/download_ui_controller.h" |
| 14 #include "chrome/browser/history/history_service.h" | 14 #include "chrome/browser/history/history_service.h" |
| 15 #include "chrome/browser/history/history_service_factory.h" | 15 #include "chrome/browser/history/history_service_factory.h" |
| 16 #include "chrome/browser/net/chrome_net_log.h" | 16 #include "chrome/browser/net/chrome_net_log.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 19 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 19 #include "content/public/browser/download_manager.h" | 20 #include "content/public/browser/download_manager.h" |
| 20 | 21 |
| 21 #if defined(ENABLE_EXTENSIONS) | 22 #if defined(ENABLE_EXTENSIONS) |
| 22 #include "chrome/browser/extensions/api/downloads/downloads_api.h" | 23 #include "chrome/browser/extensions/api/downloads/downloads_api.h" |
| 23 #endif | 24 #endif |
| 24 | 25 |
| 25 using content::BrowserContext; | 26 using content::BrowserContext; |
| 26 using content::DownloadManager; | 27 using content::DownloadManager; |
| 27 using content::DownloadManagerDelegate; | 28 using content::DownloadManagerDelegate; |
| 28 | 29 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 57 | 58 |
| 58 if (!profile_->IsOffTheRecord()) { | 59 if (!profile_->IsOffTheRecord()) { |
| 59 HistoryService* history = HistoryServiceFactory::GetForProfile( | 60 HistoryService* history = HistoryServiceFactory::GetForProfile( |
| 60 profile_, Profile::EXPLICIT_ACCESS); | 61 profile_, Profile::EXPLICIT_ACCESS); |
| 61 history->GetNextDownloadId( | 62 history->GetNextDownloadId( |
| 62 manager_delegate_->GetDownloadIdReceiverCallback()); | 63 manager_delegate_->GetDownloadIdReceiverCallback()); |
| 63 download_history_.reset(new DownloadHistory( | 64 download_history_.reset(new DownloadHistory( |
| 64 manager, | 65 manager, |
| 65 scoped_ptr<DownloadHistory::HistoryAdapter>( | 66 scoped_ptr<DownloadHistory::HistoryAdapter>( |
| 66 new DownloadHistory::HistoryAdapter(history)))); | 67 new DownloadHistory::HistoryAdapter(history)))); |
| 68 |
| 69 // Include this download manager in the set monitored by safe browsing. |
| 70 g_browser_process->safe_browsing_service()->AddDownloadManager(manager); |
| 67 } | 71 } |
| 68 | 72 |
| 69 // Pass an empty delegate when constructing the DownloadUIController. The | 73 // Pass an empty delegate when constructing the DownloadUIController. The |
| 70 // default delegate does all the notifications we need. | 74 // default delegate does all the notifications we need. |
| 71 download_ui_.reset(new DownloadUIController( | 75 download_ui_.reset(new DownloadUIController( |
| 72 manager, scoped_ptr<DownloadUIController::Delegate>())); | 76 manager, scoped_ptr<DownloadUIController::Delegate>())); |
| 73 | 77 |
| 74 // Include this download manager in the set monitored by the | 78 // Include this download manager in the set monitored by the |
| 75 // global status updater. | 79 // global status updater. |
| 76 g_browser_process->download_status_updater()->AddManager(manager); | 80 g_browser_process->download_status_updater()->AddManager(manager); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // code) when the DownloadManager is shutting down. So we shut it down | 175 // code) when the DownloadManager is shutting down. So we shut it down |
| 172 // manually earlier. See http://crbug.com/131692 | 176 // manually earlier. See http://crbug.com/131692 |
| 173 BrowserContext::GetDownloadManager(profile_)->Shutdown(); | 177 BrowserContext::GetDownloadManager(profile_)->Shutdown(); |
| 174 } | 178 } |
| 175 #if defined(ENABLE_EXTENSIONS) | 179 #if defined(ENABLE_EXTENSIONS) |
| 176 extension_event_router_.reset(); | 180 extension_event_router_.reset(); |
| 177 #endif | 181 #endif |
| 178 manager_delegate_.reset(); | 182 manager_delegate_.reset(); |
| 179 download_history_.reset(); | 183 download_history_.reset(); |
| 180 } | 184 } |
| OLD | NEW |