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

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

Issue 663023007: Include high-fidelity metadata about a download in incident reports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: sync to r300417 Created 6 years, 2 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_protection_service.cc
diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
index b00646a2c1fbf45d133b1c4bad56e802b5fed15e..62f82c1d221178a947f60fc346fa5d45788a7bf5 100644
--- a/chrome/browser/safe_browsing/download_protection_service.cc
+++ b/chrome/browser/safe_browsing/download_protection_service.cc
@@ -732,6 +732,8 @@ class DownloadProtectionService::CheckClientDownloadRequest
return;
}
+ service_->client_download_request_callbacks_.Notify(item_, &request);
+
VLOG(2) << "Sending a request for URL: "
<< item_->GetUrlChain().back();
fetcher_.reset(net::URLFetcher::Create(0 /* ID used for testing */,
@@ -782,6 +784,13 @@ class DownloadProtectionService::CheckClientDownloadRequest
base::TimeTicks::Now() - timeout_start_time_);
}
}
+ if (result == SAFE && (reason == REASON_WHITELISTED_URL ||
+ reason == REASON_TRUSTED_EXECUTABLE)) {
+ // This is a supported download for which a ClientDownloadRequest is not
robertshield 2014/10/21 13:15:38 What does a supported download mean in this contex
grt (UTC plus 2) 2014/10/23 19:53:12 One for which CheckClientDownload was called.
+ // generated. Clear out metadata for what has now become a stale download.
+ // TODO(grt): persist metadata for these downloads as well.
+ service_->client_download_request_callbacks_.Notify(item_, nullptr);
+ }
if (service_) {
VLOG(2) << "SafeBrowsing download verdict for: "
<< item_->DebugString(true) << " verdict:" << reason
@@ -961,6 +970,12 @@ bool DownloadProtectionService::IsSupportedDownload(
#endif
}
+DownloadProtectionService::ClientDownloadRequestSubscription
+DownloadProtectionService::RegisterClientDownloadRequestCallback(
+ const ClientDownloadRequestCallback& callback) {
+ return client_download_request_callbacks_.Add(callback);
+}
+
void DownloadProtectionService::CancelPendingRequests() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
for (std::set<scoped_refptr<CheckClientDownloadRequest> >::iterator it =

Powered by Google App Engine
This is Rietveld 408576698