blob: 31facf8f2490ff6bec70bd5fec08e06c3d84af75 [file] [log] [blame]
[email protected]b3841c502011-03-09 01:21:311// Copyright (c) 2011 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
[email protected]afd1e522011-04-27 23:29:595#include "content/browser/user_metrics.h"
[email protected]ca59d8a2010-12-23 01:22:046
[email protected]5f945a0e2011-03-01 17:47:537#include "content/browser/browser_thread.h"
[email protected]b3841c502011-03-09 01:21:318#include "content/common/notification_service.h"
[email protected]0d6e9bd2011-10-18 04:29:169#include "content/public/browser/notification_types.h"
[email protected]29cf16772010-04-21 15:13:4710
11void UserMetrics::RecordAction(const UserMetricsAction& action) {
12 Record(action.str_);
13}
14
15void UserMetrics::RecordComputedAction(const std::string& action) {
16 Record(action.c_str());
17}
18
19void UserMetrics::Record(const char *action) {
[email protected]ca59d8a2010-12-23 01:22:0420 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
21 BrowserThread::PostTask(
22 BrowserThread::UI, FROM_HERE,
23 NewRunnableFunction(&UserMetrics::CallRecordOnUI, action));
24 return;
25 }
26
[email protected]432115822011-07-10 15:52:2727 NotificationService::current()->Notify(content::NOTIFICATION_USER_ACTION,
[email protected]29cf16772010-04-21 15:13:4728 NotificationService::AllSources(),
[email protected]896220042010-03-23 18:14:2829 Details<const char*>(&action));
30}
31
[email protected]ca59d8a2010-12-23 01:22:0432void UserMetrics::CallRecordOnUI(const std::string& action) {
33 Record(action.c_str());
34}