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

Unified Diff: chrome/browser/system_monitor/media_storage_util.cc

Issue 10933114: Combine boolean MediaDeviceNotifications histograms to an enumerated histogram. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 years, 3 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
Index: chrome/browser/system_monitor/media_storage_util.cc
diff --git a/chrome/browser/system_monitor/media_storage_util.cc b/chrome/browser/system_monitor/media_storage_util.cc
index c6a03ed6c1b057450d8aa2ff3bc0b9c237412a72..ce808d4821bf6bf1ac054b405cc13c9aab476ce8 100644
--- a/chrome/browser/system_monitor/media_storage_util.cc
+++ b/chrome/browser/system_monitor/media_storage_util.cc
@@ -11,6 +11,7 @@
#include "base/callback.h"
#include "base/file_util.h"
#include "base/logging.h"
+#include "base/metrics/histogram.h"
#include "base/system_monitor/system_monitor.h"
#include "content/public/browser/browser_thread.h"
@@ -34,6 +35,19 @@ namespace {
typedef std::vector<SystemMonitor::RemovableStorageInfo> RemovableStorageInfo;
+// MediaDeviceNotification.DeviceInfo histogram values.
+enum DeviceInfoHistogramBuckets {
+ MASS_STORAGE_DEVICE_NAME_AND_UUID_AVAILABLE,
+ MASS_STORAGE_DEVICE_UUID_MISSING,
+ MASS_STORAGE_DEVICE_NAME_MISSING,
+ MASS_STORAGE_DEVICE_NAME_AND_UUID_MISSING,
+ MTP_STORAGE_DEVICE_NAME_AND_UUID_AVAILABLE,
+ MTP_STORAGE_DEVICE_UUID_MISSING,
+ MTP_STORAGE_DEVICE_NAME_MISSING,
+ MTP_STORAGE_DEVICE_NAME_AND_UUID_MISSING,
+ DEVICE_INFO_BUCKET_BOUNDARY
+};
+
// Prefix constants for different device id spaces.
const char kRemovableMassStorageWithDCIMPrefix[] = "dcim:";
const char kRemovableMassStorageNoDCIMPrefix[] = "nodcim:";
@@ -276,6 +290,29 @@ FilePath MediaStorageUtil::FindDevicePathById(const std::string& device_id) {
}
// static
+void MediaStorageUtil::RecordDeviceInfoHistogram(bool mass_storage,
+ const std::string& device_uuid,
+ const string16& device_name) {
+ unsigned int event_number = 0;
+ if (!mass_storage)
+ event_number = 4;
+
+ if (device_name.empty())
+ event_number += 2;
+
+ if (device_uuid.empty())
+ event_number += 1;
+ enum DeviceInfoHistogramBuckets event =
+ static_cast<enum DeviceInfoHistogramBuckets>(event_number);
+ if (event >= DEVICE_INFO_BUCKET_BOUNDARY) {
+ NOTREACHED();
+ return;
+ }
+ UMA_HISTOGRAM_ENUMERATION("MediaDeviceNotifications.DeviceInfo", event,
+ DEVICE_INFO_BUCKET_BOUNDARY);
+}
+
+// static
void MediaStorageUtil::SetGetDeviceInfoFromPathFunctionForTesting(
GetDeviceInfoFromPathFunction function) {
g_test_get_device_info_from_path_function = function;

Powered by Google App Engine
This is Rietveld 408576698