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

Unified Diff: chrome/browser/notifications/sync_notifier/synced_notification_stats.cc

Issue 26943002: Add UMA histogram data representing the Synced Notifications feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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/notifications/sync_notifier/synced_notification_stats.cc
diff --git a/chrome/browser/notifications/sync_notifier/synced_notification_stats.cc b/chrome/browser/notifications/sync_notifier/synced_notification_stats.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d7bb0723bb28dd8e81269e5bdf843c7ceb96403f
--- /dev/null
+++ b/chrome/browser/notifications/sync_notifier/synced_notification_stats.cc
@@ -0,0 +1,47 @@
+// Copyright (c) 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/notifications/sync_notifier/synced_notification_stats.h"
+
+#include <string>
+
+#include "base/metrics/histogram.h"
+#include "content/public/browser/user_metrics.h"
+
+namespace notifier {
+
+SyncedNotificationStats::SyncedNotificationStats() {}
+
+SyncedNotificationStats::SyncedNotificationStats(
+ const std::string& id) : id_(id) {
+ for (size_t i = 0; i < SYNCED_NOTIFICATION_ACTION_COUNT; i++) {
Alexei Svitkine (slow) 2013/10/11 14:50:12 Nit: ++i and remove {}'s
Pete Williamson 2013/10/14 03:46:07 Done.
+ actions_[i] = false;
+ }
+}
+
+SyncedNotificationStats::~SyncedNotificationStats() {}
+
+void SyncedNotificationStats::CollectAction(
+ SyncedNotificationActionType type) {
+ DCHECK(!id_.empty());
+
+ UMA_HISTOGRAM_ENUMERATION("Notifications.Actions",
+ type,
+ SYNCED_NOTIFICATION_ACTION_COUNT);
+ actions_[type] = true;
+}
+
+void SyncedNotificationStats::RecordAggregateStats() {
+ DCHECK(!id_.empty());
+
+ for (size_t i = 0; i < SYNCED_NOTIFICATION_ACTION_COUNT; i++) {
+ if (!actions_[i])
+ continue;
+ UMA_HISTOGRAM_ENUMERATION("Notifications.PerNotificationActions",
+ i,
+ SYNCED_NOTIFICATION_ACTION_COUNT);
Alexei Svitkine (slow) 2013/10/11 14:50:12 This looks strange to me. I'm not familiar with th
Pete Williamson 2013/10/14 03:46:07 I was hoping to ask you if I needed it or not. I
Alexei Svitkine (slow) 2013/10/15 17:12:03 The other stuff should work on its own. Unless you
Pete Williamson 2013/10/16 02:24:21 OK, after a closer reading of the code, the PerNot
+ }
+}
+
+} // namespace notifier

Powered by Google App Engine
This is Rietveld 408576698