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 "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 if (is_extended_reporting_) { | 859 if (is_extended_reporting_) { |
860 request.mutable_population()->set_user_population( | 860 request.mutable_population()->set_user_population( |
861 ChromeUserPopulation::EXTENDED_REPORTING); | 861 ChromeUserPopulation::EXTENDED_REPORTING); |
862 } else { | 862 } else { |
863 request.mutable_population()->set_user_population( | 863 request.mutable_population()->set_user_population( |
864 ChromeUserPopulation::SAFE_BROWSING); | 864 ChromeUserPopulation::SAFE_BROWSING); |
865 } | 865 } |
866 request.set_url(SanitizeUrl(item_->GetUrlChain().back())); | 866 request.set_url(SanitizeUrl(item_->GetUrlChain().back())); |
867 request.mutable_digests()->set_sha256(item_->GetHash()); | 867 request.mutable_digests()->set_sha256(item_->GetHash()); |
868 request.set_length(item_->GetReceivedBytes()); | 868 request.set_length(item_->GetReceivedBytes()); |
869 request.set_skipped_url_whitelist(skipped_url_whitelist_); | 869 request.set_skipped_url_whitelist(true); |
870 request.set_skipped_certificate_whitelist(skipped_certificate_whitelist_); | 870 request.set_skipped_certificate_whitelist(true); |
871 for (size_t i = 0; i < item_->GetUrlChain().size(); ++i) { | 871 for (size_t i = 0; i < item_->GetUrlChain().size(); ++i) { |
872 ClientDownloadRequest::Resource* resource = request.add_resources(); | 872 ClientDownloadRequest::Resource* resource = request.add_resources(); |
873 resource->set_url(SanitizeUrl(item_->GetUrlChain()[i])); | 873 resource->set_url(SanitizeUrl(item_->GetUrlChain()[i])); |
874 if (i == item_->GetUrlChain().size() - 1) { | 874 if (i == item_->GetUrlChain().size() - 1) { |
875 // The last URL in the chain is the download URL. | 875 // The last URL in the chain is the download URL. |
876 resource->set_type(ClientDownloadRequest::DOWNLOAD_URL); | 876 resource->set_type(ClientDownloadRequest::DOWNLOAD_URL); |
877 resource->set_referrer(SanitizeUrl(item_->GetReferrerUrl())); | 877 resource->set_referrer(SanitizeUrl(item_->GetReferrerUrl())); |
878 DVLOG(2) << "dl url " << resource->url(); | 878 DVLOG(2) << "dl url " << resource->url(); |
879 if (!item_->GetRemoteAddress().empty()) { | 879 if (!item_->GetRemoteAddress().empty()) { |
880 resource->set_remote_ip(item_->GetRemoteAddress()); | 880 resource->set_remote_ip(item_->GetRemoteAddress()); |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 GURL DownloadProtectionService::GetDownloadRequestUrl() { | 1314 GURL DownloadProtectionService::GetDownloadRequestUrl() { |
1315 GURL url(kDownloadRequestUrl); | 1315 GURL url(kDownloadRequestUrl); |
1316 std::string api_key = google_apis::GetAPIKey(); | 1316 std::string api_key = google_apis::GetAPIKey(); |
1317 if (!api_key.empty()) | 1317 if (!api_key.empty()) |
1318 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); | 1318 url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true)); |
1319 | 1319 |
1320 return url; | 1320 return url; |
1321 } | 1321 } |
1322 | 1322 |
1323 } // namespace safe_browsing | 1323 } // namespace safe_browsing |
OLD | NEW |