1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/public/browser/user_metrics.h"
8 #include "content/public/browser/browser_thread.h"
9 #include "content/public/browser/notification_service.h"
10 #include "content/public/browser/notification_types.h"
15 // Forward declare because of circular dependency.
16 void CallRecordOnUI(const std::string
& action
);
18 void Record(const char *action
) {
19 if (!BrowserThread::CurrentlyOn(BrowserThread::UI
)) {
20 BrowserThread::PostTask(
23 base::Bind(&CallRecordOnUI
, action
));
27 NotificationService::current()->Notify(
28 NOTIFICATION_USER_ACTION
,
29 NotificationService::AllSources(),
30 Details
<const char*>(&action
));
33 void CallRecordOnUI(const std::string
& action
) {
34 Record(action
.c_str());
39 void RecordAction(const UserMetricsAction
& action
) {
43 void RecordComputedAction(const std::string
& action
) {
44 Record(action
.c_str());
47 } // namespace content