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

Unified Diff: content/browser/user_metrics.cc

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move to content namespace. Update usages. Update extract_actions tool. Created 9 years 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: content/browser/user_metrics.cc
diff --git a/content/browser/user_metrics.cc b/content/browser/user_metrics.cc
index b3596543154ca076b686a1093775c84493cf709d..c7a9cfc2159a45000ec9b5f50a3a28de7129c582 100644
--- a/content/browser/user_metrics.cc
+++ b/content/browser/user_metrics.cc
@@ -2,27 +2,28 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/user_metrics.h"
+#include "content/public/browser/user_metrics.h"
#include "base/bind.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
+#include "content/public/browser/user_metrics.h"
jam 2011/12/14 01:18:38 nit: redundant
-using content::BrowserThread;
+namespace {
-void UserMetrics::RecordAction(const UserMetricsAction& action) {
- Record(action.str_);
-}
+using content::BrowserThread;
+using content::UserMetricsAction;
-void UserMetrics::RecordComputedAction(const std::string& action) {
- Record(action.c_str());
-}
+// Forward declare because of circular dependency.
+void CallRecordOnUI(const std::string& action);
-void UserMetrics::Record(const char *action) {
+void Record(const char *action) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
- BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- base::Bind(&UserMetrics::CallRecordOnUI, action));
+ BrowserThread::PostTask(
+ BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&CallRecordOnUI, action));
return;
}
@@ -32,6 +33,20 @@ void UserMetrics::Record(const char *action) {
content::Details<const char*>(&action));
}
-void UserMetrics::CallRecordOnUI(const std::string& action) {
+void CallRecordOnUI(const std::string& action) {
Record(action.c_str());
}
+
+} // namespace
+
+namespace content {
+
+void RecordAction(const UserMetricsAction& action) {
+ Record(action.str_);
+}
+
+void RecordComputedAction(const std::string& action) {
+ Record(action.c_str());
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698