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

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 - fix histograms.xml formatting 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..9585d81832ef0e888575ace9c6ee866c3ceb0676 100644
--- a/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc
+++ b/chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.cc
@@ -4,11 +4,14 @@
#include "chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h"
+
+#include "base/metrics/histogram.h"
#include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h"
#include "chrome/browser/notifications/sync_notifier/synced_notification.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "content/public/browser/page_navigator.h"
+#include "content/public/browser/user_metrics.h"
namespace notifier {
ChromeNotifierDelegate::ChromeNotifierDelegate(
@@ -26,6 +29,15 @@ content::RenderViewHost* ChromeNotifierDelegate::GetRenderViewHost() const {
return NULL;
}
+void ChromeNotifierDelegate::CollectAction(SyncedNotificationActionType type) {
+ DCHECK(!notification_id_.empty());
+
+ UMA_HISTOGRAM_ENUMERATION("SyncedNotifications.Actions",
+ type,
+ SYNCED_NOTIFICATION_ACTION_COUNT);
+}
+
+
// TODO(petewil) Add the ability to do URL actions also.
void ChromeNotifierDelegate::Click() {
SyncedNotification* notification =
@@ -36,6 +48,9 @@ void ChromeNotifierDelegate::Click() {
GURL destination = notification->GetDefaultDestinationUrl();
NavigateToUrl(destination);
chrome_notifier_->MarkNotificationAsRead(notification_id_);
+
+ // Record the action in UMA statistics.
+ CollectAction(SYNCED_NOTIFICATION_ACTION_CLICK);
}
// TODO(petewil) Add the ability to do URL actions also.
@@ -47,6 +62,9 @@ void ChromeNotifierDelegate::ButtonClick(int button_index) {
NavigateToUrl(destination);
chrome_notifier_->MarkNotificationAsRead(notification_id_);
}
+
+ // Now record the UMA statistics for this action.
+ CollectAction(SYNCED_NOTIFICATION_ACTION_BUTTON_CLICK);
}
void ChromeNotifierDelegate::NavigateToUrl(const GURL& destination) const {
@@ -68,6 +86,10 @@ void ChromeNotifierDelegate::NavigateToUrl(const GURL& destination) const {
void ChromeNotifierDelegate::Close(bool by_user) {
if (by_user)
chrome_notifier_->MarkNotificationAsRead(notification_id_);
+
+ CollectAction(by_user ?
+ SYNCED_NOTIFICATION_ACTION_CLOSE_BY_USER :
+ SYNCED_NOTIFICATION_ACTION_CLOSE_BY_SYSTEM);
}
} // namespace notifier
« no previous file with comments | « chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h ('k') | tools/metrics/actions/chromeactions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698