OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 crx_installers_[crx_installer.get()] = item->id(); | 200 crx_installers_[crx_installer.get()] = item->id(); |
201 // The status text and percent complete indicator will change now | 201 // The status text and percent complete indicator will change now |
202 // that we are installing a CRX. Update observers so that they pick | 202 // that we are installing a CRX. Update observers so that they pick |
203 // up the change. | 203 // up the change. |
204 item->UpdateObservers(); | 204 item->UpdateObservers(); |
205 return false; | 205 return false; |
206 } | 206 } |
207 | 207 |
208 bool ChromeDownloadManagerDelegate::GenerateFileHash() { | 208 bool ChromeDownloadManagerDelegate::GenerateFileHash() { |
209 #if defined(ENABLE_SAFE_BROWSING) | 209 #if defined(ENABLE_SAFE_BROWSING) |
210 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); | |
210 return profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled) && | 211 return profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled) && |
211 g_browser_process->safe_browsing_service()->DownloadBinHashNeeded(); | 212 (sb_service->DownloadBinHashNeeded() || |
213 (sb_service->download_protection_service() && | |
214 sb_service->download_protection_service()->enabled())); | |
Randy Smith (Not in Mondays)
2011/11/18 23:27:17
Why this change? Why can't sb_service->DownloadBi
noelutz
2011/11/18 23:30:24
Good point. Done.
| |
212 #else | 215 #else |
213 return false; | 216 return false; |
214 #endif | 217 #endif |
215 } | 218 } |
216 | 219 |
217 void ChromeDownloadManagerDelegate::OnResponseCompleted(DownloadItem* item) { | 220 void ChromeDownloadManagerDelegate::OnResponseCompleted(DownloadItem* item) { |
218 // TODO(noelutz): remove this method from the delegate API. | 221 // TODO(noelutz): remove this method from the delegate API. |
219 } | 222 } |
220 | 223 |
221 void ChromeDownloadManagerDelegate::AddItemToPersistentStore( | 224 void ChromeDownloadManagerDelegate::AddItemToPersistentStore( |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
591 int32 download_id, int64 db_handle) { | 594 int32 download_id, int64 db_handle) { |
592 // It's not immediately obvious, but HistoryBackend::CreateDownload() can | 595 // It's not immediately obvious, but HistoryBackend::CreateDownload() can |
593 // call this function with an invalid |db_handle|. For instance, this can | 596 // call this function with an invalid |db_handle|. For instance, this can |
594 // happen when the history database is offline. We cannot have multiple | 597 // happen when the history database is offline. We cannot have multiple |
595 // DownloadItems with the same invalid db_handle, so we need to assign a | 598 // DownloadItems with the same invalid db_handle, so we need to assign a |
596 // unique |db_handle| here. | 599 // unique |db_handle| here. |
597 if (db_handle == DownloadItem::kUninitializedHandle) | 600 if (db_handle == DownloadItem::kUninitializedHandle) |
598 db_handle = download_history_->GetNextFakeDbHandle(); | 601 db_handle = download_history_->GetNextFakeDbHandle(); |
599 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); | 602 download_manager_->OnItemAddedToPersistentStore(download_id, db_handle); |
600 } | 603 } |
OLD | NEW |