Index: content/browser/user_metrics.cc |
diff --git a/content/browser/user_metrics.cc b/content/browser/user_metrics.cc |
index 927f3977d6b589f3363ca1c3d9b4a594d48c36ff..e352bfe8079f0bc17dba3aeb5fe7cbe823f6dfad 100644 |
--- a/content/browser/user_metrics.cc |
+++ b/content/browser/user_metrics.cc |
@@ -5,13 +5,16 @@ |
#include "content/public/browser/user_metrics.h" |
#include "base/bind.h" |
+#include "base/lazy_instance.h" |
+#include "base/observer_list.h" |
#include "content/public/browser/browser_thread.h" |
-#include "content/public/browser/notification_service.h" |
-#include "content/public/browser/notification_types.h" |
namespace content { |
namespace { |
+base::LazyInstance<ObserverList<UserMetricsObserver> > g_observers = |
+ LAZY_INSTANCE_INITIALIZER; |
+ |
// Forward declare because of circular dependency. |
void CallRecordOnUI(const std::string& action); |
@@ -24,10 +27,7 @@ void Record(const char *action) { |
return; |
} |
- NotificationService::current()->Notify( |
- NOTIFICATION_USER_ACTION, |
- NotificationService::AllSources(), |
- Details<const char*>(&action)); |
+ FOR_EACH_OBSERVER(UserMetricsObserver, g_observers.Get(), UserAction(action)); |
} |
void CallRecordOnUI(const std::string& action) { |
@@ -44,4 +44,15 @@ void RecordComputedAction(const std::string& action) { |
Record(action.c_str()); |
} |
+void UserMetricsObserver::UserAction(const std::string& action) { |
+} |
+ |
+UserMetricsObserver::UserMetricsObserver() { |
+ g_observers.Get().AddObserver(this); |
+} |
+ |
+UserMetricsObserver::~UserMetricsObserver() { |
+ g_observers.Get().RemoveObserver(this); |
+} |
+ |
} // namespace content |