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/chrome_download_manager_delegate.h" | 5 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "chrome/browser/ui/browser_finder.h" | 53 #include "chrome/browser/ui/browser_finder.h" |
54 #endif | 54 #endif |
55 | 55 |
56 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
57 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" | 57 #include "chrome/browser/chromeos/gdata/gdata_download_observer.h" |
58 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 58 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
59 #include "chrome/browser/download/download_file_picker_chromeos.h" | 59 #include "chrome/browser/download/download_file_picker_chromeos.h" |
60 #include "chrome/browser/download/save_package_file_picker_chromeos.h" | 60 #include "chrome/browser/download/save_package_file_picker_chromeos.h" |
61 #endif | 61 #endif |
62 | 62 |
| 63 #if defined(OS_WIN) |
| 64 #include "chrome/browser/download/download_completion_observer_win.h" |
| 65 #endif // OS_WIN |
| 66 |
63 using content::BrowserContext; | 67 using content::BrowserContext; |
64 using content::BrowserThread; | 68 using content::BrowserThread; |
65 using content::DownloadId; | 69 using content::DownloadId; |
66 using content::DownloadItem; | 70 using content::DownloadItem; |
67 using content::DownloadManager; | 71 using content::DownloadManager; |
68 using content::WebContents; | 72 using content::WebContents; |
69 using safe_browsing::DownloadProtectionService; | 73 using safe_browsing::DownloadProtectionService; |
70 | 74 |
71 namespace { | 75 namespace { |
72 | 76 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) { | 136 void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) { |
133 download_manager_ = dm; | 137 download_manager_ = dm; |
134 download_history_.reset(new DownloadHistory(profile_)); | 138 download_history_.reset(new DownloadHistory(profile_)); |
135 download_history_->Load( | 139 download_history_->Load( |
136 base::Bind(&DownloadManager::OnPersistentStoreQueryComplete, | 140 base::Bind(&DownloadManager::OnPersistentStoreQueryComplete, |
137 base::Unretained(dm))); | 141 base::Unretained(dm))); |
138 #if !defined(OS_ANDROID) | 142 #if !defined(OS_ANDROID) |
139 extension_event_router_.reset(new ExtensionDownloadsEventRouter( | 143 extension_event_router_.reset(new ExtensionDownloadsEventRouter( |
140 profile_, download_manager_)); | 144 profile_, download_manager_)); |
141 #endif | 145 #endif |
| 146 |
| 147 #if defined(OS_WIN) |
| 148 DownloadCompletionObserver* download_completion = |
| 149 new DownloadCompletionObserver(dm); |
| 150 #endif // OS_WIN |
142 } | 151 } |
143 | 152 |
144 void ChromeDownloadManagerDelegate::Shutdown() { | 153 void ChromeDownloadManagerDelegate::Shutdown() { |
145 download_history_.reset(); | 154 download_history_.reset(); |
146 download_prefs_.reset(); | 155 download_prefs_.reset(); |
147 #if !defined(OS_ANDROID) | 156 #if !defined(OS_ANDROID) |
148 extension_event_router_.reset(); | 157 extension_event_router_.reset(); |
149 #endif | 158 #endif |
150 } | 159 } |
151 | 160 |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 int32 download_id, int64 db_handle) { | 829 int32 download_id, int64 db_handle) { |
821 // It's not immediately obvious, but HistoryBackend::CreateDownload() can | 830 // It's not immediately obvious, but HistoryBackend::CreateDownload() can |
822 // call this function with an invalid |db_handle|. For instance, this can | 831 // call this function with an invalid |db_handle|. For instance, this can |
823 // happen when the history database is offline. We cannot have multiple | 832 // happen when the history database is offline. We cannot have multiple |
824 // DownloadItems with the same invalid db_handle, so we need to assign a | 833 // DownloadItems with the same invalid db_handle, so we need to assign a |
825 // unique |db_handle| here. | 834 // unique |db_handle| here. |
826 if (db_handle == DownloadItem::kUninitializedHandle) | 835 if (db_handle == DownloadItem::kUninitializedHandle) |
827 db_handle = download_history_->GetNextFakeDbHandle(); | 836 db_handle = download_history_->GetNextFakeDbHandle(); |
828 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); | 837 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); |
829 } | 838 } |
OLD | NEW |