| 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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 } | 492 } |
| 493 | 493 |
| 494 // TODO(phajdan.jr): This is apparently not being exercised in tests. | 494 // TODO(phajdan.jr): This is apparently not being exercised in tests. |
| 495 bool ChromeDownloadManagerDelegate::IsDangerousFile( | 495 bool ChromeDownloadManagerDelegate::IsDangerousFile( |
| 496 const DownloadItem& download, | 496 const DownloadItem& download, |
| 497 const DownloadStateInfo& state, | 497 const DownloadStateInfo& state, |
| 498 bool visited_referrer_before) { | 498 bool visited_referrer_before) { |
| 499 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 499 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 500 | 500 |
| 501 // Anything loaded directly from the address bar is OK. | 501 // Anything loaded directly from the address bar is OK. |
| 502 if (state.transition_type & PageTransition::FROM_ADDRESS_BAR) | 502 if (state.transition_type & content::PAGE_TRANSITION_FROM_ADDRESS_BAR) |
| 503 return false; | 503 return false; |
| 504 | 504 |
| 505 // Extensions that are not from the gallery are considered dangerous. | 505 // Extensions that are not from the gallery are considered dangerous. |
| 506 if (IsExtensionDownload(&download)) { | 506 if (IsExtensionDownload(&download)) { |
| 507 ExtensionService* service = profile_->GetExtensionService(); | 507 ExtensionService* service = profile_->GetExtensionService(); |
| 508 if (!service || !service->IsDownloadFromGallery(download.GetURL(), | 508 if (!service || !service->IsDownloadFromGallery(download.GetURL(), |
| 509 download.referrer_url())) | 509 download.referrer_url())) |
| 510 return true; | 510 return true; |
| 511 } | 511 } |
| 512 | 512 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 540 // TODO(noelutz): This function currently works as a callback place holder. | 540 // TODO(noelutz): This function currently works as a callback place holder. |
| 541 // Once we decide the hash check is reliable, we could move the | 541 // Once we decide the hash check is reliable, we could move the |
| 542 // MaybeCompleteDownload in OnAllDataSaved to this function. | 542 // MaybeCompleteDownload in OnAllDataSaved to this function. |
| 543 void ChromeDownloadManagerDelegate::CheckDownloadHashDone( | 543 void ChromeDownloadManagerDelegate::CheckDownloadHashDone( |
| 544 int32 download_id, | 544 int32 download_id, |
| 545 bool is_dangerous_hash) { | 545 bool is_dangerous_hash) { |
| 546 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 546 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 547 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id | 547 DVLOG(1) << "CheckDownloadHashDone, download_id: " << download_id |
| 548 << " is dangerous_hash: " << is_dangerous_hash; | 548 << " is dangerous_hash: " << is_dangerous_hash; |
| 549 } | 549 } |
| OLD | NEW |