Chromium Code Reviews

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

Issue 26943002: Add UMA histogram data representing the Synced Notifications feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced Notifications UMA - remove unused data Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc
diff --git a/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc b/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc
index 96f74c9b1a56925e86ef2dbd2d5703a856edfd40..ba7fa65cc6684449b346182cabd92d11dbd9a4b6 100644
--- a/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc
+++ b/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h"
#include "chrome/browser/notifications/sync_notifier/synced_notification.h"
+#include "chrome/browser/notifications/sync_notifier/synced_notification_stats.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "content/public/browser/page_navigator.h"
@@ -36,6 +37,14 @@ void ChromeNotifierDelegate::Click() {
GURL destination = notification->GetDefaultDestinationUrl();
NavigateToUrl(destination);
chrome_notifier_->MarkNotificationAsRead(notification_id_);
+
+ // Record the action in UMA statistics.
+ StatsCollection::iterator iter = stats_.find(notification_id_);
+ if (iter == stats_.end())
+ return;
+ SyncedNotificationStats& notification_stat = iter->second;
+
+ notification_stat.CollectAction(SYNCED_NOTIFICATION_ACTION_CLICK);
}
// TODO(petewil) Add the ability to do URL actions also.
@@ -47,6 +56,14 @@ void ChromeNotifierDelegate::ButtonClick(int button_index) {
NavigateToUrl(destination);
chrome_notifier_->MarkNotificationAsRead(notification_id_);
}
+
+ // Now record the UMA statistics for this action.
+ StatsCollection::iterator iter = stats_.find(notification_id_);
+ if (iter == stats_.end())
+ return;
+ SyncedNotificationStats& notification_stat = iter->second;
+
+ notification_stat.CollectAction(SYNCED_NOTIFICATION_ACTION_CLICK);
}
void ChromeNotifierDelegate::NavigateToUrl(const GURL& destination) const {
@@ -68,6 +85,15 @@ void ChromeNotifierDelegate::NavigateToUrl(const GURL& destination) const {
void ChromeNotifierDelegate::Close(bool by_user) {
if (by_user)
chrome_notifier_->MarkNotificationAsRead(notification_id_);
+
+ StatsCollection::iterator iter = stats_.find(notification_id_);
+ if (iter == stats_.end())
+ return;
+ SyncedNotificationStats& notification_stat = iter->second;
+ notification_stat.CollectAction(by_user ?
+ SYNCED_NOTIFICATION_ACTION_CLOSE_BY_USER :
+ SYNCED_NOTIFICATION_ACTION_CLOSE_BY_SYSTEM);
+ stats_.erase(notification_id_);
}
} // namespace notifier

Powered by Google App Engine