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..dc2dd179a922d7e869b5ca59c78d8e582d19dbbc 100644 |
--- a/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc |
+++ b/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc |
@@ -36,6 +36,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 +55,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 +84,17 @@ 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); |
+ notification_stat.RecordAggregateStats(); |
+ stats_.erase(notification_id_); |
+ |
} |
} // namespace notifier |