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 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
880 if (is_extended_reporting_) { | 880 if (is_extended_reporting_) { |
881 request.mutable_population()->set_user_population( | 881 request.mutable_population()->set_user_population( |
882 ChromeUserPopulation::EXTENDED_REPORTING); | 882 ChromeUserPopulation::EXTENDED_REPORTING); |
883 } else { | 883 } else { |
884 request.mutable_population()->set_user_population( | 884 request.mutable_population()->set_user_population( |
885 ChromeUserPopulation::SAFE_BROWSING); | 885 ChromeUserPopulation::SAFE_BROWSING); |
886 } | 886 } |
887 request.set_url(SanitizeUrl(item_->GetUrlChain().back())); | 887 request.set_url(SanitizeUrl(item_->GetUrlChain().back())); |
888 request.mutable_digests()->set_sha256(item_->GetHash()); | 888 request.mutable_digests()->set_sha256(item_->GetHash()); |
889 request.set_length(item_->GetReceivedBytes()); | 889 request.set_length(item_->GetReceivedBytes()); |
890 request.set_skipped_url_whitelist(true); | 890 request.set_skipped_url_whitelist(skipped_url_whitelist_); |
891 request.set_skipped_certificate_whitelist(true); | 891 request.set_skipped_certificate_whitelist(skipped_certificate_whitelist_); |
892 for (size_t i = 0; i < item_->GetUrlChain().size(); ++i) { | 892 for (size_t i = 0; i < item_->GetUrlChain().size(); ++i) { |
893 ClientDownloadRequest::Resource* resource = request.add_resources(); | 893 ClientDownloadRequest::Resource* resource = request.add_resources(); |
894 resource->set_url(SanitizeUrl(item_->GetUrlChain()[i])); | 894 resource->set_url(SanitizeUrl(item_->GetUrlChain()[i])); |
895 if (i == item_->GetUrlChain().size() - 1) { | 895 if (i == item_->GetUrlChain().size() - 1) { |
896 // The last URL in the chain is the download URL. | 896 // The last URL in the chain is the download URL. |
897 resource->set_type(ClientDownloadRequest::DOWNLOAD_URL); | 897 resource->set_type(ClientDownloadRequest::DOWNLOAD_URL); |
898 resource->set_referrer(SanitizeUrl(item_->GetReferrerUrl())); | 898 resource->set_referrer(SanitizeUrl(item_->GetReferrerUrl())); |
899 DVLOG(2) << "dl url " << resource->url(); | 899 DVLOG(2) << "dl url " << resource->url(); |
900 if (!item_->GetRemoteAddress().empty()) { | 900 if (!item_->GetRemoteAddress().empty()) { |
901 resource->set_remote_ip(item_->GetRemoteAddress()); | 901 resource->set_remote_ip(item_->GetRemoteAddress()); |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1335 GURL DownloadProtectionService::GetDownloadRequestUrl() { | 1335 GURL DownloadProtectionService::GetDownloadRequestUrl() { |
1336 GURL url(kDownloadRequestUrl); | 1336 GURL url(kDownloadRequestUrl); |
1337 std::string api_key = google_apis::GetAPIKey(); | 1337 std::string api_key = google_apis::GetAPIKey(); |
1338 if (!api_key.empty()) | 1338 if (!api_key.empty()) |
1339 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); | 1339 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); |
1340 | 1340 |
1341 return url; | 1341 return url; |
1342 } | 1342 } |
1343 | 1343 |
1344 } // namespace safe_browsing | 1344 } // namespace safe_browsing |
OLD | NEW |