Index: chrome/browser/download/chrome_download_manager_delegate.cc |
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc |
index d524121dea240f3c3bf1f0a327a712678ecea8ed..0d7bf6800d33684bce45065233e4f61273339119 100644 |
--- a/chrome/browser/download/chrome_download_manager_delegate.cc |
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc |
@@ -156,8 +156,27 @@ bool ChromeDownloadManagerDelegate::ShouldOpenDownload(DownloadItem* item) { |
} |
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() && |
+ profile_->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) { |
+ 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 +246,12 @@ void ChromeDownloadManagerDelegate::UpdatePathForItemInPersistentStore( |
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); |