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/safe_browsing/download_protection_service.h" | 5 #include "chrome/browser/safe_browsing/download_protection_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 new DownloadUrlSBClient(info, callback, sb_service_)); | 730 new DownloadUrlSBClient(info, callback, sb_service_)); |
731 // The client will release itself once it is done. | 731 // The client will release itself once it is done. |
732 BrowserThread::PostTask( | 732 BrowserThread::PostTask( |
733 BrowserThread::IO, | 733 BrowserThread::IO, |
734 FROM_HERE, | 734 FROM_HERE, |
735 base::Bind(&DownloadUrlSBClient::StartCheck, client)); | 735 base::Bind(&DownloadUrlSBClient::StartCheck, client)); |
736 } | 736 } |
737 | 737 |
738 bool DownloadProtectionService::IsSupportedFileType( | 738 bool DownloadProtectionService::IsSupportedFileType( |
739 const FilePath& filename) const { | 739 const FilePath& filename) const { |
| 740 // Currently, the UI only works on Windows. On Linux and Mac we still |
| 741 // want to show the dangerous file type warning if the file is possibly |
| 742 // dangerous which means we have to always return false here. |
| 743 #if defined(OS_WIN) |
740 return IsBinaryFile(filename); | 744 return IsBinaryFile(filename); |
| 745 #else |
| 746 return false; |
| 747 #endif |
741 } | 748 } |
742 | 749 |
743 void DownloadProtectionService::CancelPendingRequests() { | 750 void DownloadProtectionService::CancelPendingRequests() { |
744 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 751 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
745 for (std::set<scoped_refptr<CheckClientDownloadRequest> >::iterator it = | 752 for (std::set<scoped_refptr<CheckClientDownloadRequest> >::iterator it = |
746 download_requests_.begin(); | 753 download_requests_.begin(); |
747 it != download_requests_.end();) { | 754 it != download_requests_.end();) { |
748 // We need to advance the iterator before we cancel because canceling | 755 // We need to advance the iterator before we cancel because canceling |
749 // the request will invalidate it when RequestFinished is called below. | 756 // the request will invalidate it when RequestFinished is called below. |
750 scoped_refptr<CheckClientDownloadRequest> tmp = *it++; | 757 scoped_refptr<CheckClientDownloadRequest> tmp = *it++; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 | 838 |
832 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data, | 839 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data, |
833 sizeof(issuer.fingerprint().data)); | 840 sizeof(issuer.fingerprint().data)); |
834 for (std::set<std::string>::iterator it = paths_to_check.begin(); | 841 for (std::set<std::string>::iterator it = paths_to_check.begin(); |
835 it != paths_to_check.end(); ++it) { | 842 it != paths_to_check.end(); ++it) { |
836 whitelist_strings->push_back("cert/" + issuer_fp + *it); | 843 whitelist_strings->push_back("cert/" + issuer_fp + *it); |
837 } | 844 } |
838 } | 845 } |
839 | 846 |
840 } // namespace safe_browsing | 847 } // namespace safe_browsing |
OLD | NEW |