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

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

Issue 2160003002: Add UMA to record why chrome shows generic warning (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: refine comment Created 4 years, 5 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 | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
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 c3aa96086756d847e1c5d6509157a4893bb51e3e..4f5f4b4f72b19640d312401bd3b819e2a258928c 100644
--- a/chrome/browser/download/chrome_download_manager_delegate.cc
+++ b/chrome/browser/download/chrome_download_manager_delegate.cc
@@ -11,6 +11,7 @@
#include "base/callback.h"
#include "base/files/file_util.h"
#include "base/macros.h"
+#include "base/metrics/histogram.h"
#include "base/rand_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -181,6 +182,16 @@ std::string GetMimeType(const base::FilePath& path) {
return mime_type;
}
+// Reason for why danger type is DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE.
+// Used by "Download.DangerousFile.Reason" UMA metric.
+// Do not change the ordering or remove items.
+enum DangerousFileReason {
+ SB_NOT_AVAILABLE = 0,
+ SB_RETURNS_UNKOWN = 1,
+ SB_RETURNS_SAFE = 2,
+ DANGEROUS_FILE_REASON_MAX
+};
+
} // namespace
ChromeDownloadManagerDelegate::ChromeDownloadManagerDelegate(Profile* profile)
@@ -337,6 +348,8 @@ bool ChromeDownloadManagerDelegate::IsDownloadReadyForCompletion(
<< "() SB service disabled. Marking download as DANGEROUS FILE";
item->OnContentCheckCompleted(
content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE);
+ UMA_HISTOGRAM_ENUMERATION("Download.DangerousFile.Reason",
+ SB_NOT_AVAILABLE, DANGEROUS_FILE_REASON_MAX);
content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
internal_complete_callback);
return false;
@@ -686,16 +699,23 @@ void ChromeDownloadManagerDelegate::CheckClientDownloadDone(
case DownloadProtectionService::UNKNOWN:
// The check failed or was inconclusive.
if (DownloadItemModel(item).GetDangerLevel() !=
- DownloadFileType::NOT_DANGEROUS)
+ DownloadFileType::NOT_DANGEROUS) {
danger_type = content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE;
+ UMA_HISTOGRAM_ENUMERATION("Download.DangerousFile.Reason",
+ SB_RETURNS_UNKOWN,
+ DANGEROUS_FILE_REASON_MAX);
+ }
break;
case DownloadProtectionService::SAFE:
// If this file type require explicit consent, then set the danger type
// to DANGEROUS_FILE so that the user be required to manually vet
// whether the download is intended or not.
if (DownloadItemModel(item).GetDangerLevel() ==
- DownloadFileType::DANGEROUS)
+ DownloadFileType::DANGEROUS) {
danger_type = content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE;
+ UMA_HISTOGRAM_ENUMERATION("Download.DangerousFile.Reason",
+ SB_RETURNS_SAFE, DANGEROUS_FILE_REASON_MAX);
+ }
break;
case DownloadProtectionService::DANGEROUS:
danger_type = content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT;
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698