// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/download/download_stats.h"
#include "base/metrics/histogram.h"
void RecordDownloadShelfClose(int size, int in_progress, bool autoclose) {
static const int kMaxShelfSize = 16;
if (autoclose) {
UMA_HISTOGRAM_ENUMERATION(
"Download.ShelfSizeOnAutoClose", size, kMaxShelfSize);
UMA_HISTOGRAM_ENUMERATION(
"Download.ShelfInProgressSizeOnAutoClose", in_progress, kMaxShelfSize);
} else {
UMA_HISTOGRAM_ENUMERATION(
"Download.ShelfSizeOnUserClose", size, kMaxShelfSize);
UMA_HISTOGRAM_ENUMERATION(
"Download.ShelfInProgressSizeOnUserClose", in_progress, kMaxShelfSize);
}
}
void RecordDownloadCount(ChromeDownloadCountTypes type) {
UMA_HISTOGRAM_ENUMERATION(
"Download.CountsChrome", type, CHROME_DOWNLOAD_COUNT_TYPES_LAST_ENTRY);
}
void RecordDownloadSource(ChromeDownloadSource source) {
UMA_HISTOGRAM_ENUMERATION(
"Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY);
}
void RecordDangerousDownloadWarningShown(
content::DownloadDangerType danger_type) {
UMA_HISTOGRAM_ENUMERATION("Download.DownloadWarningShown",
danger_type,
content::DOWNLOAD_DANGER_TYPE_MAX);
}
void RecordOpenedDangerousConfirmDialog(
content::DownloadDangerType danger_type) {
UMA_HISTOGRAM_ENUMERATION("Download.ShowDangerousDownloadConfirmationPrompt",
danger_type,
content::DOWNLOAD_DANGER_TYPE_MAX);
}
void RecordDownloadOpenMethod(ChromeDownloadOpenMethod open_method) {
UMA_HISTOGRAM_ENUMERATION("Download.OpenMethod",
open_method,
DOWNLOAD_OPEN_METHOD_LAST_ENTRY);
}