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

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

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.h
diff --git a/chrome/browser/notifications/sync_notifier/synced_notification_stats.h b/chrome/browser/notifications/sync_notifier/synced_notification_stats.h
new file mode 100644
index 0000000000000000000000000000000000000000..2e4bdaf2caaf7c011f0ad783a3a911c60ec7c69f
--- /dev/null
+++ b/chrome/browser/notifications/sync_notifier/synced_notification_stats.h
@@ -0,0 +1,52 @@
+// 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.
+
+#ifndef CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNCED_NOTIFICATION_STATS_H_
+#define CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNCED_NOTIFICATION_STATS_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+
+namespace notifier {
+
+enum SyncedNotificationActionType {
+ SYNCED_NOTIFICATION_ACTION_UNKNOWN,
+ SYNCED_NOTIFICATION_ACTION_CLICK,
+ SYNCED_NOTIFICATION_ACTION_BUTTON_CLICK,
+ SYNCED_NOTIFICATION_ACTION_CLOSE_BY_USER,
+ SYNCED_NOTIFICATION_ACTION_CLOSE_BY_SYSTEM,
+ SYNCED_NOTIFICATION_ACTION_TOAST_TIMEOUT,
+ // NOTE: Add new action types only immediately above this line. Also,
+ // make sure the enum list in tools/histogram/histograms.xml is
+ // updated with any change in here.
+ SYNCED_NOTIFICATION_ACTION_COUNT
+};
+
+// Represents the aggregate stats for each notification.
+class SyncedNotificationStats {
+ public:
+ // Default constructor for map.
+ SyncedNotificationStats();
+
+ explicit SyncedNotificationStats(const std::string& id);
+ virtual ~SyncedNotificationStats();
+
+ // Called when we get an action from the message center.
+ void CollectAction(SyncedNotificationActionType type);
+
+ // Sends aggregate data to UMA.
+ void RecordAggregateStats();
+
+ private:
+ std::string id_;
+ bool actions_[SYNCED_NOTIFICATION_ACTION_COUNT];
+
+ DISALLOW_COPY_AND_ASSIGN(SyncedNotificationStats);
+};
+
+
Alexei Svitkine (slow) 2013/10/11 14:50:12 Nit: Remove extra blank line.
Pete Williamson 2013/10/14 03:46:07 Done.
+} // namespace notifier
+
+#endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNCED_NOTIFICATION_STATS_H_

Powered by Google App Engine
This is Rietveld 408576698