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 | |
Randy Smith (Not in Mondays)
2011/10/22 17:08:07
Can we localize the safebrowsing code in this file
| |
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 safe_browsing::DownloadProtectionService::DownloadInfo download_info; | |
234 download_info.local_file = new_path; | |
235 download_info.download_url_chain = item->url_chain(); | |
236 download_info.referrer_url = item->referrer_url(); | |
237 // TODO(bryner): Fill in the hash (we shouldn't compute it again) | |
238 download_info.total_bytes = item->total_bytes(); | |
239 // TODO(bryner): Populate user_initiated | |
240 if (sb_service->download_protection_service()->CheckClientDownload( | |
241 download_info, base::Bind( | |
242 &ChromeDownloadManagerDelegate::CheckClientDownloadDone, | |
243 this, item))) { | |
244 CheckClientDownloadDone(item, | |
245 safe_browsing::DownloadProtectionService::SAFE); | |
246 } // otherwise we will be notified asynchronously | |
247 } | |
248 #else | |
249 // Assume safe. | |
250 CheckClientDownloadDone(item, | |
251 safe_browsing::DownloadProtectionService::SAFE); | |
252 #endif | |
253 } | |
254 | |
255 void ChromeDownloadManagerDelegate::CheckClientDownloadDone( | |
256 DownloadItem* item, | |
257 safe_browsing::DownloadProtectionService::DownloadCheckResult result) { | |
258 // TODO(bryner): notify the user based on this result | |
228 } | 259 } |
229 | 260 |
230 void ChromeDownloadManagerDelegate::RemoveItemFromPersistentStore( | 261 void ChromeDownloadManagerDelegate::RemoveItemFromPersistentStore( |
231 DownloadItem* item) { | 262 DownloadItem* item) { |
232 download_history_->RemoveEntry(item); | 263 download_history_->RemoveEntry(item); |
233 } | 264 } |
234 | 265 |
235 void ChromeDownloadManagerDelegate::RemoveItemsFromPersistentStoreBetween( | 266 void ChromeDownloadManagerDelegate::RemoveItemsFromPersistentStoreBetween( |
236 const base::Time remove_begin, | 267 const base::Time remove_begin, |
237 const base::Time remove_end) { | 268 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. | 571 // TODO(noelutz): This function currently works as a callback place holder. |
541 // Once we decide the hash check is reliable, we could move the | 572 // Once we decide the hash check is reliable, we could move the |
542 // MaybeCompleteDownload in OnAllDataSaved to this function. | 573 // MaybeCompleteDownload in OnAllDataSaved to this function. |
543 void ChromeDownloadManagerDelegate::CheckDownloadHashDone( | 574 void ChromeDownloadManagerDelegate::CheckDownloadHashDone( |
544 int32 download_id, | 575 int32 download_id, |
545 bool is_dangerous_hash) { | 576 bool is_dangerous_hash) { |
546 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 577 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
547 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id | 578 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id |
548 << " is dangerous_hash: " << is_dangerous_hash; | 579 << " is dangerous_hash: " << is_dangerous_hash; |
549 } | 580 } |
OLD | NEW |