| 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/safe_browsing/download_protection_service.h" | 5 #include "chrome/browser/safe_browsing/download_protection_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 skipped_url_whitelist_ = true; | 798 skipped_url_whitelist_ = true; |
| 799 } else { | 799 } else { |
| 800 // TODO(grt): Continue processing without uploading so that | 800 // TODO(grt): Continue processing without uploading so that |
| 801 // ClientDownloadRequest callbacks can be run even for this type of safe | 801 // ClientDownloadRequest callbacks can be run even for this type of safe |
| 802 // download. | 802 // download. |
| 803 PostFinishTask(SAFE, REASON_WHITELISTED_URL); | 803 PostFinishTask(SAFE, REASON_WHITELISTED_URL); |
| 804 return; | 804 return; |
| 805 } | 805 } |
| 806 } | 806 } |
| 807 | 807 |
| 808 bool should_sample_for_certificate = ShouldSampleWhitelistedDownload(); | 808 if (!skipped_url_whitelist_ && signature_info_.trusted()) { |
| 809 if (signature_info_.trusted()) { | |
| 810 for (int i = 0; i < signature_info_.certificate_chain_size(); ++i) { | 809 for (int i = 0; i < signature_info_.certificate_chain_size(); ++i) { |
| 811 if (CertificateChainIsWhitelisted( | 810 if (CertificateChainIsWhitelisted( |
| 812 signature_info_.certificate_chain(i))) { | 811 signature_info_.certificate_chain(i))) { |
| 813 RecordCountOfWhitelistedDownload(SIGNATURE_WHITELIST); | 812 RecordCountOfWhitelistedDownload(SIGNATURE_WHITELIST); |
| 814 if (should_sample_for_certificate) { | 813 if (ShouldSampleWhitelistedDownload()) { |
| 815 skipped_certificate_whitelist_ = true; | 814 skipped_certificate_whitelist_ = true; |
| 816 break; | 815 break; |
| 817 } else { | 816 } else { |
| 818 // TODO(grt): Continue processing without uploading so that | 817 // TODO(grt): Continue processing without uploading so that |
| 819 // ClientDownloadRequest callbacks can be run even for this type of | 818 // ClientDownloadRequest callbacks can be run even for this type of |
| 820 // safe download. | 819 // safe download. |
| 821 PostFinishTask(SAFE, REASON_TRUSTED_EXECUTABLE); | 820 PostFinishTask(SAFE, REASON_TRUSTED_EXECUTABLE); |
| 822 return; | 821 return; |
| 823 } | 822 } |
| 824 } | 823 } |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1748 GURL DownloadProtectionService::GetDownloadRequestUrl() { | 1747 GURL DownloadProtectionService::GetDownloadRequestUrl() { |
| 1749 GURL url(kDownloadRequestUrl); | 1748 GURL url(kDownloadRequestUrl); |
| 1750 std::string api_key = google_apis::GetAPIKey(); | 1749 std::string api_key = google_apis::GetAPIKey(); |
| 1751 if (!api_key.empty()) | 1750 if (!api_key.empty()) |
| 1752 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); | 1751 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); |
| 1753 | 1752 |
| 1754 return url; | 1753 return url; |
| 1755 } | 1754 } |
| 1756 | 1755 |
| 1757 } // namespace safe_browsing | 1756 } // namespace safe_browsing |
| OLD | NEW |