| 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" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/message_loop_helpers.h" |
| 12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 13 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 14 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
| 15 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 16 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
| 17 #include "base/time.h" | 18 #include "base/time.h" |
| 18 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 19 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 19 #include "chrome/browser/safe_browsing/signature_util.h" | 20 #include "chrome/browser/safe_browsing/signature_util.h" |
| 20 #include "chrome/common/net/http_return.h" | 21 #include "chrome/common/net/http_return.h" |
| 21 #include "chrome/common/safe_browsing/csd.pb.h" | 22 #include "chrome/common/safe_browsing/csd.pb.h" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 // We don't need the fetcher anymore. | 450 // We don't need the fetcher anymore. |
| 450 fetcher_.reset(); | 451 fetcher_.reset(); |
| 451 RecordImprovedProtectionStats(reason); | 452 RecordImprovedProtectionStats(reason); |
| 452 UMA_HISTOGRAM_TIMES("SBClientDownload.DownloadRequestDuration", | 453 UMA_HISTOGRAM_TIMES("SBClientDownload.DownloadRequestDuration", |
| 453 base::TimeTicks::Now() - start_time_); | 454 base::TimeTicks::Now() - start_time_); |
| 454 FinishRequest(result); | 455 FinishRequest(result); |
| 455 } | 456 } |
| 456 | 457 |
| 457 private: | 458 private: |
| 458 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 459 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
| 459 friend class DeleteTask<CheckClientDownloadRequest>; | 460 friend class base::DeleteHelper<CheckClientDownloadRequest>; |
| 460 | 461 |
| 461 virtual ~CheckClientDownloadRequest() { | 462 virtual ~CheckClientDownloadRequest() { |
| 462 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 463 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 463 } | 464 } |
| 464 | 465 |
| 465 void ExtractFileFeatures() { | 466 void ExtractFileFeatures() { |
| 466 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 467 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| 467 signature_util_->CheckSignature(info_.local_file, &signature_info_); | 468 signature_util_->CheckSignature(info_.local_file, &signature_info_); |
| 468 bool is_signed = (signature_info_.certificate_chain_size() > 0); | 469 bool is_signed = (signature_info_.certificate_chain_size() > 0); |
| 469 if (is_signed) { | 470 if (is_signed) { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 | 843 |
| 843 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data, | 844 std::string issuer_fp = base::HexEncode(issuer.fingerprint().data, |
| 844 sizeof(issuer.fingerprint().data)); | 845 sizeof(issuer.fingerprint().data)); |
| 845 for (std::set<std::string>::iterator it = paths_to_check.begin(); | 846 for (std::set<std::string>::iterator it = paths_to_check.begin(); |
| 846 it != paths_to_check.end(); ++it) { | 847 it != paths_to_check.end(); ++it) { |
| 847 whitelist_strings->push_back("cert/" + issuer_fp + *it); | 848 whitelist_strings->push_back("cert/" + issuer_fp + *it); |
| 848 } | 849 } |
| 849 } | 850 } |
| 850 | 851 |
| 851 } // namespace safe_browsing | 852 } // namespace safe_browsing |
| OLD | NEW |