diff options
author | felt@chromium.org <felt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-14 18:20:11 +0000 |
---|---|---|
committer | felt@chromium.org <felt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-14 18:20:11 +0000 |
commit | 7aea00e4e7b6a31cd5776e416fe29f08198fb8e1 (patch) | |
tree | 85fac40fa5c8d794dc1ca2b9497bf7433d8368d1 | |
parent | 8a257ae00099157918f13cee285cdc1f93f2d93e (diff) | |
download | chromium_src-7aea00e4e7b6a31cd5776e416fe29f08198fb8e1.zip chromium_src-7aea00e4e7b6a31cd5776e416fe29f08198fb8e1.tar.gz chromium_src-7aea00e4e7b6a31cd5776e416fe29f08198fb8e1.tar.bz2 |
Add UMA metric for all malicious download warnings
This adds Download.MaliciousDownloadClassified, which should count all of the downloads that are labelled with one of the malicious download warnings. Each download should be recorded precisely once.
BUG=333309
Review URL: https://codereview.chromium.org/137283002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244774 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/download/download_item_impl.cc | 12 | ||||
-rw-r--r-- | content/browser/download/download_stats.cc | 6 | ||||
-rw-r--r-- | content/browser/download/download_stats.h | 3 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 9 |
4 files changed, 30 insertions, 0 deletions
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc index a12a28c..dea2602 100644 --- a/content/browser/download/download_item_impl.cc +++ b/content/browser/download/download_item_impl.cc @@ -1593,6 +1593,18 @@ void DownloadItemImpl::SetDangerType(DownloadDangerType danger_type) { net::NetLog::TYPE_DOWNLOAD_ITEM_SAFETY_STATE_UPDATED, base::Bind(&ItemCheckedNetLogCallback, danger_type)); } + // Only record the Malicious UMA stat if it's going from {not malicious} -> + // {malicious}. + if ((danger_type_ == DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS || + danger_type_ == DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE || + danger_type_ == DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT || + danger_type_ == DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT) && + (danger_type == DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST || + danger_type == DOWNLOAD_DANGER_TYPE_DANGEROUS_URL || + danger_type == DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT || + danger_type == DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED)) { + RecordMaliciousDownloadClassified(danger_type); + } danger_type_ = danger_type; } diff --git a/content/browser/download/download_stats.cc b/content/browser/download/download_stats.cc index b6e3ba8..71a9ef4 100644 --- a/content/browser/download/download_stats.cc +++ b/content/browser/download/download_stats.cc @@ -284,6 +284,12 @@ void RecordDownloadInterrupted(DownloadInterruptReason reason, UMA_HISTOGRAM_BOOLEAN("Download.InterruptedUnknownSize", unknown_size); } +void RecordMaliciousDownloadClassified(DownloadDangerType danger_type) { + UMA_HISTOGRAM_ENUMERATION("Download.MaliciousDownloadClassified", + danger_type, + DOWNLOAD_DANGER_TYPE_MAX); +} + void RecordDangerousDownloadAccept(DownloadDangerType danger_type, const base::FilePath& file_path) { UMA_HISTOGRAM_ENUMERATION("Download.DangerousDownloadValidated", diff --git a/content/browser/download/download_stats.h b/content/browser/download/download_stats.h index 0e59884..65fad8d 100644 --- a/content/browser/download/download_stats.h +++ b/content/browser/download/download_stats.h @@ -134,6 +134,9 @@ void RecordDownloadInterrupted(DownloadInterruptReason reason, int64 received, int64 total); +// Record that a download has been classified as malicious. +void RecordMaliciousDownloadClassified(DownloadDangerType danger_type); + // Record a dangerous download accept event. void RecordDangerousDownloadAccept( DownloadDangerType danger_type, diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 694c7ad..3220559 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -3170,6 +3170,15 @@ other types of suffix sets. </summary> </histogram> +<histogram name="Download.MaliciousDownloadClassified" + enum="DownloadItem.DangerType"> + <summary> + A download has been marked as malicious. Grouped by the type of danger. Each + download can only be recorded once; it will be labeled with the first type + of danger spotted. + </summary> +</histogram> + <histogram name="Download.MapErrorNetworkFailed" enum="NetErrorCodes"> <summary> Network error that produced a DOWNLOAD_INTERRUPT_REASON_NETWORK_FAILED |