1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/download/download_stats.h"
6
7 #include "base/metrics/histogram.h"
8
RecordDownloadShelfClose(int size,int in_progress,bool autoclose)9 void RecordDownloadShelfClose(int size, int in_progress, bool autoclose) {
10 static const int kMaxShelfSize = 16;
11 if (autoclose) {
12 UMA_HISTOGRAM_ENUMERATION(
13 "Download.ShelfSizeOnAutoClose", size, kMaxShelfSize);
14 UMA_HISTOGRAM_ENUMERATION(
15 "Download.ShelfInProgressSizeOnAutoClose", in_progress, kMaxShelfSize);
16 } else {
17 UMA_HISTOGRAM_ENUMERATION(
18 "Download.ShelfSizeOnUserClose", size, kMaxShelfSize);
19 UMA_HISTOGRAM_ENUMERATION(
20 "Download.ShelfInProgressSizeOnUserClose", in_progress, kMaxShelfSize);
21 }
22 }
23
RecordDownloadCount(ChromeDownloadCountTypes type)24 void RecordDownloadCount(ChromeDownloadCountTypes type) {
25 UMA_HISTOGRAM_ENUMERATION(
26 "Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY);
27 }
28
RecordDownloadSource(ChromeDownloadSource source)29 void RecordDownloadSource(ChromeDownloadSource source) {
30 UMA_HISTOGRAM_ENUMERATION(
31 "Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY);
32 }
33
RecordDangerousDownloadWarningShown(content::DownloadDangerType danger_type)34 void RecordDangerousDownloadWarningShown(
35 content::DownloadDangerType danger_type) {
36 UMA_HISTOGRAM_ENUMERATION("Download.DownloadWarningShown",
37 danger_type,
38 content::DOWNLOAD_DANGER_TYPE_MAX);
39 }
40
RecordOpenedDangerousConfirmDialog(content::DownloadDangerType danger_type)41 void RecordOpenedDangerousConfirmDialog(
42 content::DownloadDangerType danger_type) {
43 UMA_HISTOGRAM_ENUMERATION("Download.ShowDangerousDownloadConfirmationPrompt",
44 danger_type,
45 content::DOWNLOAD_DANGER_TYPE_MAX);
46 }
47
RecordDownloadOpenMethod(ChromeDownloadOpenMethod open_method)48 void RecordDownloadOpenMethod(ChromeDownloadOpenMethod open_method) {
49 UMA_HISTOGRAM_ENUMERATION("Download.OpenMethod",
50 open_method,
51 DOWNLOAD_OPEN_METHOD_LAST_ENTRY);
52 }
53