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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 void ChromeDownloadManagerDelegate::UpdateItemInPersistentStore( | 219 void ChromeDownloadManagerDelegate::UpdateItemInPersistentStore( |
220 DownloadItem* item) { | 220 DownloadItem* item) { |
221 download_history_->UpdateEntry(item); | 221 download_history_->UpdateEntry(item); |
222 } | 222 } |
223 | 223 |
224 void ChromeDownloadManagerDelegate::UpdatePathForItemInPersistentStore( | 224 void ChromeDownloadManagerDelegate::UpdatePathForItemInPersistentStore( |
225 DownloadItem* item, | 225 DownloadItem* item, |
226 const FilePath& new_path) { | 226 const FilePath& new_path) { |
227 download_history_->UpdateDownloadPath(item, new_path); | 227 download_history_->UpdateDownloadPath(item, new_path); |
| 228 |
| 229 #if defined(ENABLE_SAFE_BROWSING) |
| 230 // Begin the safe browsing download protection check. |
| 231 SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); |
| 232 if (sb_service && sb_service->download_protection_service()) { |
| 233 using safe_browsing::DownloadProtectionService; |
| 234 sb_service->download_protection_service()->CheckClientDownload( |
| 235 DownloadProtectionService::DownloadInfo::FromDownloadItem(*item), |
| 236 base::Bind(&ChromeDownloadManagerDelegate::CheckClientDownloadDone, |
| 237 this)); |
| 238 } |
| 239 #else |
| 240 // Assume safe. |
| 241 CheckClientDownloadDone(safe_browsing::DownloadProtectionService::SAFE); |
| 242 #endif |
| 243 } |
| 244 |
| 245 void ChromeDownloadManagerDelegate::CheckClientDownloadDone( |
| 246 safe_browsing::DownloadProtectionService::DownloadCheckResult result) { |
| 247 // TODO(bryner): notify the user based on this result |
228 } | 248 } |
229 | 249 |
230 void ChromeDownloadManagerDelegate::RemoveItemFromPersistentStore( | 250 void ChromeDownloadManagerDelegate::RemoveItemFromPersistentStore( |
231 DownloadItem* item) { | 251 DownloadItem* item) { |
232 download_history_->RemoveEntry(item); | 252 download_history_->RemoveEntry(item); |
233 } | 253 } |
234 | 254 |
235 void ChromeDownloadManagerDelegate::RemoveItemsFromPersistentStoreBetween( | 255 void ChromeDownloadManagerDelegate::RemoveItemsFromPersistentStoreBetween( |
236 const base::Time remove_begin, | 256 const base::Time remove_begin, |
237 const base::Time remove_end) { | 257 const base::Time remove_end) { |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 // TODO(noelutz): This function currently works as a callback place holder. | 560 // TODO(noelutz): This function currently works as a callback place holder. |
541 // Once we decide the hash check is reliable, we could move the | 561 // Once we decide the hash check is reliable, we could move the |
542 // MaybeCompleteDownload in OnAllDataSaved to this function. | 562 // MaybeCompleteDownload in OnAllDataSaved to this function. |
543 void ChromeDownloadManagerDelegate::CheckDownloadHashDone( | 563 void ChromeDownloadManagerDelegate::CheckDownloadHashDone( |
544 int32 download_id, | 564 int32 download_id, |
545 bool is_dangerous_hash) { | 565 bool is_dangerous_hash) { |
546 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 566 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
547 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id | 567 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id |
548 << " is dangerous_hash: " << is_dangerous_hash; | 568 << " is dangerous_hash: " << is_dangerous_hash; |
549 } | 569 } |
OLD | NEW |