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

Unified Diff: content/browser/download/download_manager_impl.cc

Issue 2901563003: PDF: Add UMA to track embedded PDF triggered drive-by downloads. (Closed)
Patch Set: Created 3 years, 7 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: content/browser/download/download_manager_impl.cc
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
index 44ac7f581afaafa94fd42f39bbb25a546d2f11fb..7b233ee51f2e7df09cf7b8e50e6326ebfe7f15df 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -174,6 +174,8 @@ class DownloadItemFactoryImpl : public DownloadItemFactory {
}
};
+constexpr char kPDFMimeType[] = "application/pdf";
+
} // namespace
DownloadManagerImpl::DownloadManagerImpl(net::NetLog* net_log,
@@ -203,6 +205,10 @@ DownloadItemImpl* DownloadManagerImpl::CreateActiveItem(
item_factory_->CreateActiveItem(this, id, info, net_log);
downloads_[id] = base::WrapUnique(download);
downloads_by_guid_[download->GetGuid()] = download;
+
+ if (info.mime_type == kPDFMimeType && !info.has_user_gesture)
+ delegate_->RecordDriveByPDFDownload();
+
return download;
}

Powered by Google App Engine
This is Rietveld 408576698