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

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: 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/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

Powered by Google App Engine
This is Rietveld 408576698