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

Unified Diff: chrome/browser/download/chrome_download_manager_delegate.cc

Issue 2901563003: PDF: Add UMA to track embedded PDF triggered drive-by downloads. (Closed)
Patch Set: remove stray comment 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
« no previous file with comments | « no previous file | chrome/common/BUILD.gn » ('j') | chrome/common/BUILD.gn » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/chrome_download_manager_delegate.cc
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc
index 37c55d6a14feb6b932b00063801f9f4caf33dbd0..55dd7fecbeff13f21ba1ae1ada2d8e810b05910b 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -78,6 +78,10 @@
#include "extensions/common/constants.h"
#endif
+#if BUILDFLAG(ENABLE_PLUGINS)
+#include "chrome/common/pdf_uma.h"
+#endif
+
using content::BrowserThread;
using content::DownloadItem;
using content::DownloadManager;
@@ -206,6 +210,10 @@ const DownloadPathReservationTracker::FilenameConflictAction
kDefaultPlatformConflictAction = DownloadPathReservationTracker::UNIQUIFY;
#endif
+#if BUILDFLAG(ENABLE_PLUGINS)
+constexpr char kPDFMimeType[] = "application/pdf";
+#endif
+
} // namespace
ChromeDownloadManagerDelegate::ChromeDownloadManagerDelegate(Profile* profile)
@@ -283,6 +291,13 @@ void ChromeDownloadManagerDelegate::ReturnNextId(
bool ChromeDownloadManagerDelegate::DetermineDownloadTarget(
DownloadItem* download,
const content::DownloadTargetCallback& callback) {
+#if BUILDFLAG(ENABLE_PLUGINS)
+ if (download->GetTargetFilePath().empty() &&
+ download->GetMimeType() == kPDFMimeType && !download->HasUserGesture()) {
+ ReportPDFLoadStatus(PDFLoadStatus::TRIGGERED_NO_GESTURE_DRIVE_BY_DOWNLOAD);
+ }
+#endif
+
DownloadTargetDeterminer::CompletionCallback target_determined_callback =
base::Bind(&ChromeDownloadManagerDelegate::OnDownloadTargetDetermined,
weak_ptr_factory_.GetWeakPtr(),
« no previous file with comments | « no previous file | chrome/common/BUILD.gn » ('j') | chrome/common/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698