Chromium Code Reviews| 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_ |