Chromium Code Reviews| Index: chrome/browser/download/chrome_download_manager_delegate.cc |
| =================================================================== |
| --- chrome/browser/download/chrome_download_manager_delegate.cc (revision 107249) |
| +++ chrome/browser/download/chrome_download_manager_delegate.cc (working copy) |
| @@ -156,8 +156,26 @@ |
| } |
| bool ChromeDownloadManagerDelegate::ShouldCompleteDownload(DownloadItem* item) { |
| - if (!IsExtensionDownload(item)) |
| + if (!IsExtensionDownload(item)) { |
| +#if defined(ENABLE_SAFE_BROWSING) |
| + // Begin the safe browsing download protection check. |
| + SafeBrowsingService* sb_service = |
| + g_browser_process->safe_browsing_service(); |
| + if (sb_service && sb_service->download_protection_service()) { |
|
mattm
2011/10/26 23:27:36
I think we need a check here or in CheckClientDown
Brian Ryner
2011/10/27 01:03:04
Done. In the interest of keeping things simple, I
|
| + using safe_browsing::DownloadProtectionService; |
| + sb_service->download_protection_service()->CheckClientDownload( |
| + DownloadProtectionService::DownloadInfo::FromDownloadItem(*item), |
| + base::Bind( |
| + &ChromeDownloadManagerDelegate::CheckClientDownloadDone, |
| + this, item->id())); |
| + // For now, we won't delay the download for this. |
| + } |
| +#else |
| + // Assume safe. |
| +#endif |
| + |
| return true; |
| + } |
| scoped_refptr<CrxInstaller> crx_installer = |
| download_crx_util::OpenChromeExtension(profile_, *item); |
| @@ -227,6 +245,12 @@ |
| download_history_->UpdateDownloadPath(item, new_path); |
| } |
| +void ChromeDownloadManagerDelegate::CheckClientDownloadDone( |
| + int32 download_id, |
| + safe_browsing::DownloadProtectionService::DownloadCheckResult result) { |
| + // TODO(bryner): notify the user based on this result |
| +} |
| + |
| void ChromeDownloadManagerDelegate::RemoveItemFromPersistentStore( |
| DownloadItem* item) { |
| download_history_->RemoveEntry(item); |