Chromium Code Reviews| Index: chrome/browser/download/chrome_download_manager_delegate.cc |
| =================================================================== |
| --- chrome/browser/download/chrome_download_manager_delegate.cc (revision 106177) |
| +++ chrome/browser/download/chrome_download_manager_delegate.cc (working copy) |
| @@ -225,8 +225,34 @@ |
| DownloadItem* item, |
| const FilePath& new_path) { |
| download_history_->UpdateDownloadPath(item, new_path); |
| + |
| + // Begin the safe browsing download protection check. |
|
noelutz
2011/10/19 16:12:49
Should you also add '#if defined(ENABLE_SAFE_BROWS
Brian Ryner
2011/10/19 18:06:59
Good catch, done. Will also make sure to run this
|
| + SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); |
| + if (sb_service && sb_service->download_protection_service()) { |
| + safe_browsing::DownloadProtectionService::DownloadInfo download_info; |
| + download_info.local_file = new_path; |
| + download_info.download_url_chain = item->url_chain(); |
| + download_info.referrer_url = item->referrer_url(); |
| + // TODO(bryner): Fill in the hash (we shouldn't compute it again) |
| + download_info.total_bytes = item->total_bytes(); |
| + // TODO(bryner): Populate user_initiated |
| + if (sb_service->download_protection_service()->CheckClientDownload( |
| + download_info, base::Bind( |
| + &ChromeDownloadManagerDelegate::CheckClientDownloadDone, |
| + base::Unretained(this), |
|
noelutz
2011/10/19 16:12:49
Not sure you need base::Unretained because this is
Brian Ryner
2011/10/19 18:06:59
I think you're right -- changed. I'm not sure abo
|
| + item))) { |
| + CheckClientDownloadDone(item, |
| + safe_browsing::DownloadProtectionService::SAFE); |
| + } // otherwise we will be notified asynchronously |
| + } |
| } |
| +void ChromeDownloadManagerDelegate::CheckClientDownloadDone( |
| + DownloadItem* item, |
| + safe_browsing::DownloadProtectionService::DownloadCheckResult result) { |
| + // TODO(bryner): notify the user based on this result |
| +} |
| + |
| void ChromeDownloadManagerDelegate::RemoveItemFromPersistentStore( |
| DownloadItem* item) { |
| download_history_->RemoveEntry(item); |