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 30 matching lines...) Expand all Loading... |
41 download_manager_created_ = true; | 41 download_manager_created_ = true; |
42 | 42 |
43 // In case the delegate has already been set by | 43 // In case the delegate has already been set by |
44 // SetDownloadManagerDelegateForTesting. | 44 // SetDownloadManagerDelegateForTesting. |
45 if (!manager_delegate_.get()) | 45 if (!manager_delegate_.get()) |
46 manager_delegate_.reset(new ChromeDownloadManagerDelegate(profile_)); | 46 manager_delegate_.reset(new ChromeDownloadManagerDelegate(profile_)); |
47 | 47 |
48 manager_delegate_->SetDownloadManager(manager); | 48 manager_delegate_->SetDownloadManager(manager); |
49 | 49 |
50 #if !defined(OS_ANDROID) | 50 #if !defined(OS_ANDROID) |
51 extension_event_router_.reset(new ExtensionDownloadsEventRouter( | 51 extension_event_router_.reset( |
52 profile_, manager)); | 52 new extensions::ExtensionDownloadsEventRouter(profile_, manager)); |
53 #endif | 53 #endif |
54 | 54 |
55 if (!profile_->IsOffTheRecord()) { | 55 if (!profile_->IsOffTheRecord()) { |
56 HistoryService* history = HistoryServiceFactory::GetForProfile( | 56 HistoryService* history = HistoryServiceFactory::GetForProfile( |
57 profile_, Profile::EXPLICIT_ACCESS); | 57 profile_, Profile::EXPLICIT_ACCESS); |
58 history->GetNextDownloadId( | 58 history->GetNextDownloadId( |
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>( |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // code) when the DownloadManager is shutting down. So we shut it down | 169 // code) when the DownloadManager is shutting down. So we shut it down |
170 // manually earlier. See http://crbug.com/131692 | 170 // manually earlier. See http://crbug.com/131692 |
171 BrowserContext::GetDownloadManager(profile_)->Shutdown(); | 171 BrowserContext::GetDownloadManager(profile_)->Shutdown(); |
172 } | 172 } |
173 #if !defined(OS_ANDROID) | 173 #if !defined(OS_ANDROID) |
174 extension_event_router_.reset(); | 174 extension_event_router_.reset(); |
175 #endif | 175 #endif |
176 manager_delegate_.reset(); | 176 manager_delegate_.reset(); |
177 download_history_.reset(); | 177 download_history_.reset(); |
178 } | 178 } |
OLD | NEW |