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

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

Issue 10933114: Combine boolean MediaDeviceNotifications histograms to an enumerated histogram. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/removable_device_notifications_histogram.cc
diff --git a/chrome/browser/system_monitor/removable_device_notifications_histogram.cc b/chrome/browser/system_monitor/removable_device_notifications_histogram.cc
new file mode 100644
index 0000000000000000000000000000000000000000..150df95d13a221bd92e9438d05c5cdc87623294e
--- /dev/null
+++ b/chrome/browser/system_monitor/removable_device_notifications_histogram.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2012 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/system_monitor/removable_device_notifications_histogram.h"
+
+#include "base/logging.h"
+#include "base/metrics/histogram.h"
+
+namespace chrome {
+
+namespace {
+
+// MediaDeviceNotification.DeviceInfo histogram values.
+enum DeviceInfoHistogramBuckets {
+ MASS_STORAGE_DEVICE_NAME_AND_UUID_AVAILABLE,
+ MASS_STORAGE_DEVICE_NAME_AVAILABLE_AND_UUID_NOT_AVAILABLE,
vandebo (ex-Chrome) 2012/09/16 22:27:46 could call this FOO_UUID_MISSING
kmadhusu 2012/09/17 18:29:07 Done.
+ MASS_STORAGE_DEVICE_NAME_NOT_AVAILABLE_AND_UUID_AVAILABLE,
+ MASS_STORAGE_DEVICE_NAME_AND_UUID_NOT_AVAILABLE,
+ MTP_STORAGE_DEVICE_NAME_AND_UUID_AVAILABLE,
vandebo (ex-Chrome) 2012/09/16 22:27:46 the removable device notifiers only handle mass st
kmadhusu 2012/09/17 18:29:07 Moved to MediaStorageUtil.
+ MTP_STORAGE_DEVICE_NAME_AVAILABLE_AND_UUID_NOT_AVAILABLE,
+ MTP_STORAGE_DEVICE_NAME_NOT_AVAILABLE_AND_UUID_AVAILABLE,
+ MTP_STORAGE_DEVICE_NAME_AND_UUID_NOT_AVAILABLE,
+ DEVICE_INFO_BUCKET_BOUNDARY
+};
+
+} // namespace
+
+void RecordDeviceInfoHistogram(MediaStorageUtil::Type device_type,
vandebo (ex-Chrome) 2012/09/16 22:27:46 bool mass_storage, so you don't have to figure out
kmadhusu 2012/09/17 18:29:07 Done.
+ const std::string& device_uuid,
+ const string16& device_name) {
+ int event_number = device_type == MediaStorageUtil::MTP_OR_PTP ? 4 : 0;
+ event_number += device_name.empty() ? 2 : 0;
vandebo (ex-Chrome) 2012/09/16 22:27:46 if (device_name.empty()) event_number += 2;
kmadhusu 2012/09/17 18:29:07 Done.
+ event_number += device_uuid.empty() ? 1 : 0;
+ 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);
+}
+
+} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698