Split UserMetrics into API vs. implementation. Move API to content/public.

[email protected]
BUG=98716

Review URL: http://codereview.chromium.org/8919017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114416 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/appcache/appcache_dispatcher_host.cc b/content/browser/appcache/appcache_dispatcher_host.cc
index 16c90268..f8f4260 100644
--- a/content/browser/appcache/appcache_dispatcher_host.cc
+++ b/content/browser/appcache/appcache_dispatcher_host.cc
@@ -7,8 +7,10 @@
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "content/browser/appcache/chrome_appcache_service.h"
-#include "content/browser/user_metrics.h"
 #include "content/common/appcache_messages.h"
+#include "content/public/browser/user_metrics.h"
+
+using content::UserMetricsAction;
 
 AppCacheDispatcherHost::AppCacheDispatcherHost(
     ChromeAppCacheService* appcache_service,
@@ -62,7 +64,7 @@
 }
 
 void AppCacheDispatcherHost::BadMessageReceived() {
-  UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_ACDH"));
+  content::RecordAction(UserMetricsAction("BadMessageTerminate_ACDH"));
   BrowserMessageFilter::BadMessageReceived();
 }
 
diff --git a/content/browser/browser_message_filter.cc b/content/browser/browser_message_filter.cc
index 64ed8bd..dd2414c 100644
--- a/content/browser/browser_message_filter.cc
+++ b/content/browser/browser_message_filter.cc
@@ -9,11 +9,12 @@
 #include "base/logging.h"
 #include "base/process.h"
 #include "base/process_util.h"
-#include "content/browser/user_metrics.h"
+#include "content/public/browser/user_metrics.h"
 #include "content/public/common/result_codes.h"
 #include "ipc/ipc_sync_message.h"
 
 using content::BrowserThread;
+using content::UserMetricsAction;
 
 BrowserMessageFilter::BrowserMessageFilter()
     : channel_(NULL), peer_handle_(base::kNullProcessHandle) {
@@ -89,7 +90,7 @@
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO) || rv) <<
       "Must handle messages that were dispatched to another thread!";
   if (!message_was_ok) {
-    UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_BMF"));
+    content::RecordAction(UserMetricsAction("BadMessageTerminate_BMF"));
     BadMessageReceived();
   }
 
diff --git a/content/browser/file_system/file_system_dispatcher_host.cc b/content/browser/file_system/file_system_dispatcher_host.cc
index e2a052b..2f60fc9 100644
--- a/content/browser/file_system/file_system_dispatcher_host.cc
+++ b/content/browser/file_system/file_system_dispatcher_host.cc
@@ -11,8 +11,8 @@
 #include "base/platform_file.h"
 #include "base/threading/thread.h"
 #include "base/time.h"
-#include "content/browser/user_metrics.h"
 #include "content/common/file_system_messages.h"
+#include "content/public/browser/user_metrics.h"
 #include "googleurl/src/gurl.h"
 #include "ipc/ipc_platform_file.h"
 #include "net/url_request/url_request_context.h"
@@ -25,6 +25,7 @@
 #include "webkit/fileapi/file_system_util.h"
 
 using content::BrowserThread;
+using content::UserMetricsAction;
 using fileapi::FileSystemCallbackDispatcher;
 using fileapi::FileSystemFileUtil;
 using fileapi::FileSystemOperation;
@@ -165,9 +166,9 @@
     int request_id, const GURL& origin_url, fileapi::FileSystemType type,
     int64 requested_size, bool create) {
   if (type == fileapi::kFileSystemTypeTemporary) {
-    UserMetrics::RecordAction(UserMetricsAction("OpenFileSystemTemporary"));
+    content::RecordAction(UserMetricsAction("OpenFileSystemTemporary"));
   } else if (type == fileapi::kFileSystemTypePersistent) {
-    UserMetrics::RecordAction(UserMetricsAction("OpenFileSystemPersistent"));
+    content::RecordAction(UserMetricsAction("OpenFileSystemPersistent"));
   }
   GetNewOperation(request_id)->OpenFileSystem(origin_url, type, create);
 }
diff --git a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
index 1fbfbed..8a7f622 100644
--- a/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
+++ b/content/browser/in_process_webkit/indexed_db_dispatcher_host.cc
@@ -11,9 +11,9 @@
 #include "content/browser/in_process_webkit/indexed_db_database_callbacks.h"
 #include "content/browser/in_process_webkit/indexed_db_transaction_callbacks.h"
 #include "content/browser/renderer_host/render_message_filter.h"
-#include "content/browser/user_metrics.h"
 #include "content/common/indexed_db_messages.h"
 #include "content/public/browser/browser_thread.h"
+#include "content/public/browser/user_metrics.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/common/result_codes.h"
 #include "googleurl/src/gurl.h"
@@ -31,6 +31,7 @@
 #include "webkit/glue/webkit_glue.h"
 
 using content::BrowserThread;
+using content::UserMetricsAction;
 using WebKit::WebDOMStringList;
 using WebKit::WebExceptionCode;
 using WebKit::WebIDBCallbacks;
@@ -283,7 +284,7 @@
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
   ObjectType* return_object = map->Lookup(return_object_id);
   if (!return_object) {
-    UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_IDBMF"));
+    content::RecordAction(UserMetricsAction("BadMessageTerminate_IDBMF"));
     BadMessageReceived();
   }
   return return_object;
diff --git a/content/browser/renderer_host/database_message_filter.cc b/content/browser/renderer_host/database_message_filter.cc
index 5494b42..6cc293c 100644
--- a/content/browser/renderer_host/database_message_filter.cc
+++ b/content/browser/renderer_host/database_message_filter.cc
@@ -11,12 +11,12 @@
 #include "base/string_util.h"
 #include "base/threading/thread.h"
 #include "base/utf_string_conversions.h"
-#include "content/browser/user_metrics.h"
 #include "content/common/database_messages.h"
+#include "content/public/browser/user_metrics.h"
 #include "content/public/common/result_codes.h"
 #include "googleurl/src/gurl.h"
-#include "third_party/sqlite/sqlite3.h"
 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
+#include "third_party/sqlite/sqlite3.h"
 #include "webkit/database/database_util.h"
 #include "webkit/database/vfs_backend.h"
 #include "webkit/quota/quota_manager.h"
@@ -26,6 +26,7 @@
 #endif
 
 using content::BrowserThread;
+using content::UserMetricsAction;
 using quota::QuotaManager;
 using quota::QuotaManagerProxy;
 using quota::QuotaStatusCode;
@@ -300,7 +301,7 @@
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
   if (!database_connections_.IsDatabaseOpened(
           origin_identifier, database_name)) {
-    UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_DBMF"));
+    content::RecordAction(UserMetricsAction("BadMessageTerminate_DBMF"));
     BadMessageReceived();
     return;
   }
@@ -313,7 +314,7 @@
   DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
   if (!database_connections_.IsDatabaseOpened(
           origin_identifier, database_name)) {
-    UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_DBMF"));
+    content::RecordAction(UserMetricsAction("BadMessageTerminate_DBMF"));
     BadMessageReceived();
     return;
   }
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 238a1a2..82f3f82 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -28,13 +28,13 @@
 #include "content/browser/renderer_host/render_view_host_delegate.h"
 #include "content/browser/renderer_host/render_widget_helper.h"
 #include "content/browser/resource_context.h"
-#include "content/browser/user_metrics.h"
 #include "content/common/child_process_host_impl.h"
 #include "content/common/child_process_messages.h"
 #include "content/common/desktop_notification_messages.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/content_browser_client.h"
+#include "content/public/browser/user_metrics.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/common/url_constants.h"
 #include "ipc/ipc_channel_handle.h"
@@ -69,6 +69,7 @@
 using content::BrowserThread;
 using content::ChildProcessHostImpl;
 using content::PluginServiceFilter;
+using content::UserMetricsAction;
 using net::CookieStore;
 
 namespace {
@@ -812,7 +813,7 @@
   if (!ChildProcessSecurityPolicy::GetInstance()->HasPermissionsForFile(
           render_process_id_, path, flags)) {
     DLOG(ERROR) << "Bad flags in ViewMsgHost_AsyncOpenFile message: " << flags;
-    UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_AOF"));
+    content::RecordAction(UserMetricsAction("BadMessageTerminate_AOF"));
     BadMessageReceived();
     return;
   }
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 61b136b..1230458 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -80,13 +80,13 @@
 #include "content/browser/resource_context.h"
 #include "content/browser/speech/speech_input_dispatcher_host.h"
 #include "content/browser/trace_message_filter.h"
-#include "content/browser/user_metrics.h"
 #include "content/browser/webui/web_ui_factory.h"
 #include "content/browser/worker_host/worker_message_filter.h"
 #include "content/common/child_process_host_impl.h"
 #include "content/common/child_process_messages.h"
 #include "content/common/gpu/gpu_messages.h"
 #include "content/public/browser/notification_service.h"
+#include "content/public/browser/user_metrics.h"
 #include "content/common/resource_messages.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/content_browser_client.h"
@@ -118,6 +118,7 @@
 using content::BrowserThread;
 using content::ChildProcessHost;
 using content::ChildProcessHostImpl;
+using content::UserMetricsAction;
 
 // This class creates the IO thread for the renderer when running in
 // single-process mode.  It's not used in multi-process mode.
@@ -911,7 +912,7 @@
       // The message had a handler, but its de-serialization failed.
       // We consider this a capital crime. Kill the renderer if we have one.
       LOG(ERROR) << "bad message " << msg.type() << " terminating renderer.";
-      UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH"));
+      content::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH"));
       ReceivedBadMessage();
     }
     return true;
@@ -1308,7 +1309,7 @@
 
 void RenderProcessHostImpl::OnUserMetricsRecordAction(
     const std::string& action) {
-  UserMetrics::RecordComputedAction(action);
+  content::RecordComputedAction(action);
 }
 
 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) {
diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc
index 62ad2595a4..d38ce05e 100644
--- a/content/browser/renderer_host/render_view_host.cc
+++ b/content/browser/renderer_host/render_view_host.cc
@@ -29,7 +29,6 @@
 #include "content/browser/renderer_host/render_widget_host.h"
 #include "content/browser/renderer_host/render_widget_host_view.h"
 #include "content/browser/site_instance.h"
-#include "content/browser/user_metrics.h"
 #include "content/common/desktop_notification_messages.h"
 #include "content/common/drag_messages.h"
 #include "content/common/speech_input_messages.h"
@@ -41,6 +40,7 @@
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/notification_types.h"
 #include "content/public/browser/render_view_host_observer.h"
+#include "content/public/browser/user_metrics.h"
 #include "content/public/common/bindings_policy.h"
 #include "content/public/common/content_constants.h"
 #include "content/public/common/result_codes.h"
@@ -55,6 +55,7 @@
 
 using base::TimeDelta;
 using content::BrowserThread;
+using content::UserMetricsAction;
 using WebKit::WebConsoleMessage;
 using WebKit::WebDragOperation;
 using WebKit::WebDragOperationNone;
@@ -742,7 +743,7 @@
   if (!msg_is_ok) {
     // The message had a handler, but its de-serialization failed.
     // Kill the renderer.
-    UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVH"));
+    content::RecordAction(UserMetricsAction("BadMessageTerminate_RVH"));
     process()->ReceivedBadMessage();
   }
 
diff --git a/content/browser/renderer_host/render_widget_host.cc b/content/browser/renderer_host/render_widget_host.cc
index bc598a0..d48963e8 100644
--- a/content/browser/renderer_host/render_widget_host.cc
+++ b/content/browser/renderer_host/render_widget_host.cc
@@ -21,12 +21,12 @@
 #include "content/browser/renderer_host/render_process_host_impl.h"
 #include "content/browser/renderer_host/render_widget_helper.h"
 #include "content/browser/renderer_host/render_widget_host_view.h"
-#include "content/browser/user_metrics.h"
 #include "content/common/gpu/gpu_messages.h"
-#include "content/public/browser/notification_service.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/native_web_keyboard_event.h"
+#include "content/public/browser/notification_service.h"
 #include "content/public/browser/notification_types.h"
+#include "content/public/browser/user_metrics.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/common/result_codes.h"
 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderline.h"
@@ -38,7 +38,7 @@
 using base::Time;
 using base::TimeDelta;
 using base::TimeTicks;
-
+using content::UserMetricsAction;
 using WebKit::WebGestureEvent;
 using WebKit::WebInputEvent;
 using WebKit::WebKeyboardEvent;
@@ -245,7 +245,7 @@
 
   if (!msg_is_ok) {
     // The message de-serialization failed. Kill the renderer process.
-    UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RWH"));
+    content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH"));
     process()->ReceivedBadMessage();
   }
   return handled;
@@ -1032,7 +1032,7 @@
     if (dib) {
       if (dib->size() < size) {
         DLOG(WARNING) << "Transport DIB too small for given rectangle";
-        UserMetrics::RecordAction(
+        content::RecordAction(
             UserMetricsAction("BadMessageTerminate_RWH1"));
         process()->ReceivedBadMessage();
       } else {
@@ -1155,7 +1155,7 @@
 
   int type = static_cast<int>(event_type);
   if (type < WebInputEvent::Undefined) {
-    UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RWH2"));
+    content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH2"));
     process()->ReceivedBadMessage();
   } else if (type == WebInputEvent::MouseMove) {
     mouse_move_pending_ = false;
@@ -1200,13 +1200,13 @@
 
 void RenderWidgetHost::OnMsgFocus() {
   // Only RenderViewHost can deal with that message.
-  UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RWH4"));
+  content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH4"));
   process()->ReceivedBadMessage();
 }
 
 void RenderWidgetHost::OnMsgBlur() {
   // Only RenderViewHost can deal with that message.
-  UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RWH5"));
+  content::RecordAction(UserMetricsAction("BadMessageTerminate_RWH5"));
   process()->ReceivedBadMessage();
 }
 
@@ -1457,50 +1457,50 @@
 
 void RenderWidgetHost::Undo() {
   Send(new ViewMsg_Undo(routing_id()));
-  UserMetrics::RecordAction(UserMetricsAction("Undo"));
+  content::RecordAction(UserMetricsAction("Undo"));
 }
 
 void RenderWidgetHost::Redo() {
   Send(new ViewMsg_Redo(routing_id()));
-  UserMetrics::RecordAction(UserMetricsAction("Redo"));
+  content::RecordAction(UserMetricsAction("Redo"));
 }
 
 void RenderWidgetHost::Cut() {
   Send(new ViewMsg_Cut(routing_id()));
-  UserMetrics::RecordAction(UserMetricsAction("Cut"));
+  content::RecordAction(UserMetricsAction("Cut"));
 }
 
 void RenderWidgetHost::Copy() {
   Send(new ViewMsg_Copy(routing_id()));
-  UserMetrics::RecordAction(UserMetricsAction("Copy"));
+  content::RecordAction(UserMetricsAction("Copy"));
 }
 
 void RenderWidgetHost::CopyToFindPboard() {
 #if defined(OS_MACOSX)
   // Windows/Linux don't have the concept of a find pasteboard.
   Send(new ViewMsg_CopyToFindPboard(routing_id()));
-  UserMetrics::RecordAction(UserMetricsAction("CopyToFindPboard"));
+  content::RecordAction(UserMetricsAction("CopyToFindPboard"));
 #endif
 }
 
 void RenderWidgetHost::Paste() {
   Send(new ViewMsg_Paste(routing_id()));
-  UserMetrics::RecordAction(UserMetricsAction("Paste"));
+  content::RecordAction(UserMetricsAction("Paste"));
 }
 
 void RenderWidgetHost::PasteAndMatchStyle() {
   Send(new ViewMsg_PasteAndMatchStyle(routing_id()));
-  UserMetrics::RecordAction(UserMetricsAction("PasteAndMatchStyle"));
+  content::RecordAction(UserMetricsAction("PasteAndMatchStyle"));
 }
 
 void RenderWidgetHost::Delete() {
   Send(new ViewMsg_Delete(routing_id()));
-  UserMetrics::RecordAction(UserMetricsAction("DeleteSelection"));
+  content::RecordAction(UserMetricsAction("DeleteSelection"));
 }
 
 void RenderWidgetHost::SelectAll() {
   Send(new ViewMsg_SelectAll(routing_id()));
-  UserMetrics::RecordAction(UserMetricsAction("SelectAll"));
+  content::RecordAction(UserMetricsAction("SelectAll"));
 }
 bool RenderWidgetHost::GotResponseToLockMouseRequest(bool allowed) {
   if (!allowed) {
diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc
index f69efe1..b2718ea 100644
--- a/content/browser/tab_contents/navigation_controller.cc
+++ b/content/browser/tab_contents/navigation_controller.cc
@@ -21,16 +21,18 @@
 #include "content/browser/tab_contents/navigation_entry.h"
 #include "content/browser/tab_contents/tab_contents.h"
 #include "content/browser/tab_contents/tab_contents_delegate.h"
-#include "content/browser/user_metrics.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/common/content_constants.h"
 #include "content/common/view_messages.h"
+#include "content/public/browser/notification_service.h"
 #include "content/public/browser/notification_types.h"
+#include "content/public/browser/user_metrics.h"
+#include "content/public/common/content_constants.h"
 #include "net/base/escape.h"
 #include "net/base/mime_util.h"
 #include "net/base/net_util.h"
 #include "webkit/glue/webkit_glue.h"
 
+using content::UserMetricsAction;
+
 namespace {
 
 const int kInvalidateAll = 0xFFFFFFFF;
@@ -695,7 +697,7 @@
     // Because the unknown entry has committed, we risk showing the wrong URL in
     // release builds. Instead, we'll kill the renderer process to be safe.
     LOG(ERROR) << "terminating renderer for bad navigation: " << params.url;
-    UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_NC"));
+    content::RecordAction(UserMetricsAction("BadMessageTerminate_NC"));
 
     // Temporary code so we can get more information.  Format:
     //  http://url/foo.html#page1#max3#frame1#ids:2_Nx,1_1x,3_2
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 4324339..8fb4397 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -37,13 +37,13 @@
 #include "content/browser/tab_contents/tab_contents_observer.h"
 #include "content/browser/tab_contents/tab_contents_view.h"
 #include "content/browser/tab_contents/title_updated_details.h"
-#include "content/browser/user_metrics.h"
 #include "content/browser/webui/web_ui_factory.h"
 #include "content/common/intents_messages.h"
 #include "content/common/view_messages.h"
 #include "content/public/browser/content_browser_client.h"
 #include "content/public/browser/devtools_agent_host_registry.h"
 #include "content/public/browser/notification_service.h"
+#include "content/public/browser/user_metrics.h"
 #include "content/public/common/bindings_policy.h"
 #include "content/public/common/content_constants.h"
 #include "content/public/common/content_restriction.h"
@@ -110,6 +110,7 @@
 using content::DevToolsAgentHost;
 using content::DevToolsAgentHostRegistry;
 using content::DevToolsManagerImpl;
+using content::UserMetricsAction;
 
 namespace {
 
@@ -327,7 +328,7 @@
   IPC_END_MESSAGE_MAP_EX()
 
   if (!message_is_ok) {
-    UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD"));
+    content::RecordAction(UserMetricsAction("BadMessageTerminate_RVD"));
     GetRenderProcessHost()->ReceivedBadMessage();
   }
 
@@ -1072,7 +1073,7 @@
 }
 
 void TabContents::OnDidDisplayInsecureContent() {
-  UserMetrics::RecordAction(UserMetricsAction("SSL.DisplayedInsecureContent"));
+  content::RecordAction(UserMetricsAction("SSL.DisplayedInsecureContent"));
   displayed_insecure_content_ = true;
   SSLManager::NotifySSLInternalStateChanged(&controller());
 }
@@ -1081,9 +1082,9 @@
     const std::string& security_origin, const GURL& target_url) {
   LOG(INFO) << security_origin << " ran insecure content from "
             << target_url.possibly_invalid_spec();
-  UserMetrics::RecordAction(UserMetricsAction("SSL.RanInsecureContent"));
+  content::RecordAction(UserMetricsAction("SSL.RanInsecureContent"));
   if (EndsWith(security_origin, kDotGoogleDotCom, false)) {
-    UserMetrics::RecordAction(
+    content::RecordAction(
         UserMetricsAction("SSL.RanInsecureContentGoogle"));
   }
   controller_.ssl_manager()->DidRunInsecureContent(security_origin);
diff --git a/content/browser/user_metrics.cc b/content/browser/user_metrics.cc
index b3596543..6be899be 100644
--- a/content/browser/user_metrics.cc
+++ b/content/browser/user_metrics.cc
@@ -2,27 +2,27 @@
 // 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"
 
+namespace {
+
 using content::BrowserThread;
+using content::UserMetricsAction;
 
-void UserMetrics::RecordAction(const UserMetricsAction& action) {
-  Record(action.str_);
-}
+// Forward declare because of circular dependency.
+void CallRecordOnUI(const std::string& action);
 
-void UserMetrics::RecordComputedAction(const std::string& action) {
-  Record(action.c_str());
-}
-
-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 +32,20 @@
       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
diff --git a/content/browser/user_metrics.h b/content/browser/user_metrics.h
deleted file mode 100644
index ae04af3..0000000
--- a/content/browser/user_metrics.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_BROWSER_USER_METRICS_H_
-#define CONTENT_BROWSER_USER_METRICS_H_
-#pragma once
-
-#include <string>
-
-#include "content/common/content_export.h"
-
-// This module provides some helper functions for logging actions tracked by
-// the user metrics system.
-
-
-// UserMetricsAction exist purely to standardize on the paramters passed to
-// UserMetrics. That way, our toolset can scan the sourcecode reliable for
-// constructors and extract the associated string constants
-struct UserMetricsAction {
-  const char* str_;
-  explicit UserMetricsAction(const char* str) : str_(str) {}
-};
-
-
-class CONTENT_EXPORT UserMetrics {
- public:
-  // Record that the user performed an action.
-  // "Action" here means a user-generated event:
-  //   good: "Reload", "CloseTab", and "IMEInvoked"
-  //   not good: "SSLDialogShown", "PageLoaded", "DiskFull"
-  // We use this to gather anonymized information about how users are
-  // interacting with the browser.
-  // WARNING: Call this function exactly like this:
-  //   UserMetrics::RecordAction(UserMetricsAction("foo bar"));
-  // (all on one line and with the metric string literal [no variables])
-  // because otherwise our processing scripts won't pick up on new actions.
-  //
-  // Once a new recorded action is added, run chrome/tools/extract_actions.py
-  // to generate a new mapping of [action hashes -> metric names] and send it
-  // out for review to be updated.
-  //
-  // For more complicated situations (like when there are many different
-  // possible actions), see RecordComputedAction.
-  static void RecordAction(const UserMetricsAction& action);
-
-  // This function has identical input and behavior to RecordAction, but is
-  // not automatically found by the action-processing scripts.  It can be used
-  // when it's a pain to enumerate all possible actions, but if you use this
-  // you need to also update the rules for extracting known actions in
-  // chrome/tools/extract_actions.py.
-  static void RecordComputedAction(const std::string& action);
-
- private:
-  static void Record(const char *action);
-  static void CallRecordOnUI(const std::string& action);
-};
-
-#endif  // CONTENT_BROWSER_USER_METRICS_H_
diff --git a/content/browser/worker_host/worker_process_host.cc b/content/browser/worker_host/worker_process_host.cc
index 178de54..494fb02 100644
--- a/content/browser/worker_host/worker_process_host.cc
+++ b/content/browser/worker_host/worker_process_host.cc
@@ -27,7 +27,6 @@
 #include "content/browser/renderer_host/render_view_host_delegate.h"
 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h"
 #include "content/browser/resource_context.h"
-#include "content/browser/user_metrics.h"
 #include "content/browser/worker_host/message_port_service.h"
 #include "content/browser/worker_host/worker_message_filter.h"
 #include "content/browser/worker_host/worker_service.h"
@@ -37,6 +36,7 @@
 #include "content/common/worker_messages.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/content_browser_client.h"
+#include "content/public/browser/user_metrics.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/common/result_codes.h"
 #include "ipc/ipc_switches.h"
@@ -50,6 +50,7 @@
 
 using content::BrowserThread;
 using content::ChildProcessHost;
+using content::UserMetricsAction;
 
 namespace {
 
@@ -320,7 +321,7 @@
 
   if (!msg_is_ok) {
     NOTREACHED();
-    UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_WPH"));
+    content::RecordAction(UserMetricsAction("BadMessageTerminate_WPH"));
     base::KillProcess(handle(), content::RESULT_CODE_KILLED_BAD_MESSAGE, false);
   }