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

Unified Diff: chrome/browser/safe_browsing/download_feedback_service.cc

Issue 2696973002: Allow Safe Browsing backend to select downloads to upload. (Closed)
Patch Set: Add unittest for DownloadProtectionService Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/download_feedback_service.cc
diff --git a/chrome/browser/safe_browsing/download_feedback_service.cc b/chrome/browser/safe_browsing/download_feedback_service.cc
index 656c80402ce1ae8e200fe6a355bc33149169ce77..6e753a7762b37bea9b18d9da58ded909770bcbe9 100644
--- a/chrome/browser/safe_browsing/download_feedback_service.cc
+++ b/chrome/browser/safe_browsing/download_feedback_service.cc
@@ -91,19 +91,32 @@ DownloadFeedbackService::~DownloadFeedbackService() {
// static
void DownloadFeedbackService::MaybeStorePingsForDownload(
DownloadProtectionService::DownloadCheckResult result,
+ bool upload_requested,
content::DownloadItem* download,
const std::string& ping,
const std::string& response) {
+ // Is this result worthy of triggering an upload?
+ bool upload_due_to_result = false;
switch (result) {
case DownloadProtectionService::UNKNOWN:
case DownloadProtectionService::SAFE:
case DownloadProtectionService::DANGEROUS:
- return;
+ upload_due_to_result = false;
+ break;
case DownloadProtectionService::UNCOMMON:
case DownloadProtectionService::DANGEROUS_HOST:
case DownloadProtectionService::POTENTIALLY_UNWANTED:
+ upload_due_to_result = true;
break; // Fall through.
}
+
+ if (!upload_requested && !upload_due_to_result)
+ return;
+
+ // Log if the result said no upload, but the server requested it anyway.
+ UMA_HISTOGRAM_BOOLEAN("SBDownloadFeedback.UploadRequestedByServer",
+ !upload_due_to_result && upload_requested);
+
UMA_HISTOGRAM_COUNTS("SBDownloadFeedback.SizeEligibleKB",
download->GetReceivedBytes() / 1024);
if (download->GetReceivedBytes() > DownloadFeedback::kMaxUploadSize)

Powered by Google App Engine
This is Rietveld 408576698