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