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 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 if (alternate_extension.empty()) | 1351 if (alternate_extension.empty()) |
1352 continue; | 1352 continue; |
1353 DCHECK_EQ(base::FilePath::kExtensionSeparator, alternate_extension[0]); | 1353 DCHECK_EQ(base::FilePath::kExtensionSeparator, alternate_extension[0]); |
1354 *(request.add_alternate_extensions()) = | 1354 *(request.add_alternate_extensions()) = |
1355 base::FilePath(alternate_extension).AsUTF8Unsafe(); | 1355 base::FilePath(alternate_extension).AsUTF8Unsafe(); |
1356 } | 1356 } |
1357 if (supported_path_ != default_file_path_) { | 1357 if (supported_path_ != default_file_path_) { |
1358 *(request.add_alternate_extensions()) = | 1358 *(request.add_alternate_extensions()) = |
1359 base::FilePath(default_file_path_.FinalExtension()).AsUTF8Unsafe(); | 1359 base::FilePath(default_file_path_.FinalExtension()).AsUTF8Unsafe(); |
1360 } | 1360 } |
1361 service_->AddReferrerChainToClientDownloadRequest( | 1361 |
1362 requestor_url_, | 1362 // TODO(676691): We should add reliable download referrer chain for PPAPI |
1363 nullptr, | 1363 // downloads too. |
1364 &request); | |
1365 | 1364 |
1366 if (!request.SerializeToString(&client_download_request_data_)) { | 1365 if (!request.SerializeToString(&client_download_request_data_)) { |
1367 // More of an internal error than anything else. Note that the UNKNOWN | 1366 // More of an internal error than anything else. Note that the UNKNOWN |
1368 // verdict gets interpreted as "allowed". | 1367 // verdict gets interpreted as "allowed". |
1369 Finish(RequestOutcome::REQUEST_MALFORMED, UNKNOWN); | 1368 Finish(RequestOutcome::REQUEST_MALFORMED, UNKNOWN); |
1370 return; | 1369 return; |
1371 } | 1370 } |
1372 | 1371 |
1373 service_->ppapi_download_request_callbacks_.Notify(&request); | 1372 service_->ppapi_download_request_callbacks_.Notify(&request); |
1374 DVLOG(2) << "Sending a PPAPI download request for URL: " << request.url(); | 1373 DVLOG(2) << "Sending a PPAPI download request for URL: " << request.url(); |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1814 download_tab_id, | 1813 download_tab_id, |
1815 kDownloadAttributionUserGestureLimit, | 1814 kDownloadAttributionUserGestureLimit, |
1816 &attribution_chain); | 1815 &attribution_chain); |
1817 UMA_HISTOGRAM_COUNTS_100( | 1816 UMA_HISTOGRAM_COUNTS_100( |
1818 "SafeBrowsing.ReferrerURLChainSize.DownloadAttribution", | 1817 "SafeBrowsing.ReferrerURLChainSize.DownloadAttribution", |
1819 attribution_chain.size()); | 1818 attribution_chain.size()); |
1820 UMA_HISTOGRAM_ENUMERATION( | 1819 UMA_HISTOGRAM_ENUMERATION( |
1821 "SafeBrowsing.ReferrerAttributionResult.DownloadAttribution", result, | 1820 "SafeBrowsing.ReferrerAttributionResult.DownloadAttribution", result, |
1822 SafeBrowsingNavigationObserverManager::ATTRIBUTION_FAILURE_TYPE_MAX); | 1821 SafeBrowsingNavigationObserverManager::ATTRIBUTION_FAILURE_TYPE_MAX); |
1823 for (auto entry : attribution_chain) | 1822 for (auto entry : attribution_chain) |
1824 *out_request->add_referrer_chain() = std::move(entry); | 1823 out_request->add_referrer_chain()->Swap(&entry); |
1825 } | 1824 } |
1826 | 1825 |
1827 } // namespace safe_browsing | 1826 } // namespace safe_browsing |
OLD | NEW |