Index: chrome/browser/metrics/metrics_service.cc |
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc |
index 303adb046ffbb9b456dcba173b343c25d46a6ba3..ab520e4624eeffb6297ed08915486b1fdde938d3 100644 |
--- a/chrome/browser/metrics/metrics_service.cc |
+++ b/chrome/browser/metrics/metrics_service.cc |
@@ -668,8 +668,6 @@ void MetricsService::SetUpNotifications( |
content::NotificationService::AllBrowserContextsAndSources()); |
registrar->Add(observer, chrome::NOTIFICATION_BROWSER_CLOSED, |
content::NotificationService::AllSources()); |
- registrar->Add(observer, content::NOTIFICATION_USER_ACTION, |
- content::NotificationService::AllSources()); |
registrar->Add(observer, chrome::NOTIFICATION_TAB_PARENTED, |
content::NotificationService::AllSources()); |
registrar->Add(observer, chrome::NOTIFICATION_TAB_CLOSING, |
@@ -702,15 +700,10 @@ void MetricsService::Observe(int type, |
DCHECK(log_manager_.current_log()); |
DCHECK(IsSingleThreaded()); |
- if (!CanLogNotification(type, source, details)) |
+ if (!CanLogNotification()) |
return; |
switch (type) { |
- case content::NOTIFICATION_USER_ACTION: |
- log_manager_.current_log()->RecordUserAction( |
- *content::Details<const char*>(details).ptr()); |
- break; |
- |
case chrome::NOTIFICATION_BROWSER_OPENED: |
case chrome::NOTIFICATION_BROWSER_CLOSED: { |
Browser* browser = content::Source<Browser>(source).ptr(); |
@@ -791,6 +784,14 @@ void MetricsService::Observe(int type, |
HandleIdleSinceLastTransmission(false); |
} |
+void MetricsService::UserAction(const std::string& action) { |
+ if (!CanLogNotification()) |
+ return; |
+ |
+ log_manager_.current_log()->RecordUserAction(action.c_str()); |
+ HandleIdleSinceLastTransmission(false); |
+} |
+ |
void MetricsService::HandleIdleSinceLastTransmission(bool in_idle) { |
// If there wasn't a lot of action, maybe the computer was asleep, in which |
// case, the log transmissions should have stopped. Here we start them up |
@@ -1945,10 +1946,7 @@ void MetricsService::RecordPluginChanges(PrefService* pref) { |
child_process_stats_buffer_.clear(); |
} |
-bool MetricsService::CanLogNotification( |
- int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) { |
+bool MetricsService::CanLogNotification() { |
// We simply don't log anything to UMA if there is a single incognito |
// session visible. The problem is that we always notify using the orginal |
// profile in order to simplify notification processing. |