Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: chrome/browser/safe_browsing/download_protection_service.cc

Issue 1911543002: Bug fix in sampling whitelisted download. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/download_protection_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/download_protection_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698