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

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 actions array and fix bug. 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..d628657de5276a20207cca99feba0e919ff6d69d 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,18 @@ void ChromeNotifierDelegate::Click() {
GURL destination = notification->GetDefaultDestinationUrl();
NavigateToUrl(destination);
chrome_notifier_->MarkNotificationAsRead(notification_id_);
+
+ // Record the action in UMA statistics.
+ SyncedNotificationStats notification_stat;
+ StatsCollection::iterator iter = stats_.find(notification_id_);
+ if (iter == stats_.end()) {
+ notification_stat = SyncedNotificationStats(notification_id_);
+ stats_[notification_id_] = notification_stat;
+ } else {
+ notification_stat = iter->second;
+ }
+
+ notification_stat.CollectAction(SYNCED_NOTIFICATION_ACTION_CLICK);
}
// TODO(petewil) Add the ability to do URL actions also.
@@ -47,6 +60,18 @@ void ChromeNotifierDelegate::ButtonClick(int button_index) {
NavigateToUrl(destination);
chrome_notifier_->MarkNotificationAsRead(notification_id_);
}
+
+ // Now record the UMA statistics for this action.
+ SyncedNotificationStats notification_stat;
+ StatsCollection::iterator iter = stats_.find(notification_id_);
+ if (iter == stats_.end()) {
+ notification_stat = SyncedNotificationStats(notification_id_);
+ stats_[notification_id_] = notification_stat;
+ } else {
+ notification_stat = iter->second;
+ }
+
+ notification_stat.CollectAction(SYNCED_NOTIFICATION_ACTION_BUTTON_CLICK);
Alexei Svitkine (slow) 2013/10/17 16:38:00 I don't think you need the new class and a map of
}
void ChromeNotifierDelegate::NavigateToUrl(const GURL& destination) const {
@@ -68,6 +93,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
This is Rietveld 408576698