| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 } | 333 } |
| 334 state->CompleteDownload(); | 334 state->CompleteDownload(); |
| 335 #endif | 335 #endif |
| 336 } | 336 } |
| 337 | 337 |
| 338 bool ChromeDownloadManagerDelegate::IsDownloadReadyForCompletion( | 338 bool ChromeDownloadManagerDelegate::IsDownloadReadyForCompletion( |
| 339 DownloadItem* item, | 339 DownloadItem* item, |
| 340 const base::Closure& internal_complete_callback) { | 340 const base::Closure& internal_complete_callback) { |
| 341 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 341 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 342 #if defined(FULL_SAFE_BROWSING) | 342 #if defined(FULL_SAFE_BROWSING) |
| 343 if (!download_prefs_->safebrowsing_for_trusted_sources_enabled() && |
| 344 download_prefs_->IsFromTrustedSource(*item)) { |
| 345 return true; |
| 346 } |
| 347 |
| 343 SafeBrowsingState* state = static_cast<SafeBrowsingState*>( | 348 SafeBrowsingState* state = static_cast<SafeBrowsingState*>( |
| 344 item->GetUserData(&kSafeBrowsingUserDataKey)); | 349 item->GetUserData(&kSafeBrowsingUserDataKey)); |
| 345 if (!state) { | 350 if (!state) { |
| 346 // Begin the safe browsing download protection check. | 351 // Begin the safe browsing download protection check. |
| 347 DownloadProtectionService* service = GetDownloadProtectionService(); | 352 DownloadProtectionService* service = GetDownloadProtectionService(); |
| 348 if (service) { | 353 if (service) { |
| 349 DVLOG(2) << __func__ << "() Start SB download check for download = " | 354 DVLOG(2) << __func__ << "() Start SB download check for download = " |
| 350 << item->DebugString(false); | 355 << item->DebugString(false); |
| 351 state = new SafeBrowsingState(); | 356 state = new SafeBrowsingState(); |
| 352 state->set_callback(internal_complete_callback); | 357 state->set_callback(internal_complete_callback); |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 923 | 928 |
| 924 case (DownloadPrefs::DownloadRestriction::ALL_FILES): | 929 case (DownloadPrefs::DownloadRestriction::ALL_FILES): |
| 925 return true; | 930 return true; |
| 926 | 931 |
| 927 default: | 932 default: |
| 928 LOG(ERROR) << "Invalid download restruction value: " | 933 LOG(ERROR) << "Invalid download restruction value: " |
| 929 << static_cast<int>(download_restriction); | 934 << static_cast<int>(download_restriction); |
| 930 } | 935 } |
| 931 return false; | 936 return false; |
| 932 } | 937 } |
| OLD | NEW |