[email protected] | b3841c50 | 2011-03-09 01:21:31 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
[email protected] | afd1e52 | 2011-04-27 23:29:59 | [diff] [blame] | 5 | #include "content/browser/user_metrics.h" |
[email protected] | ca59d8a | 2010-12-23 01:22:04 | [diff] [blame] | 6 | |
[email protected] | 5f945a0e | 2011-03-01 17:47:53 | [diff] [blame] | 7 | #include "content/browser/browser_thread.h" |
[email protected] | b3841c50 | 2011-03-09 01:21:31 | [diff] [blame] | 8 | #include "content/common/notification_service.h" |
[email protected] | 0d6e9bd | 2011-10-18 04:29:16 | [diff] [blame^] | 9 | #include "content/public/browser/notification_types.h" |
[email protected] | 29cf1677 | 2010-04-21 15:13:47 | [diff] [blame] | 10 | |
11 | void UserMetrics::RecordAction(const UserMetricsAction& action) { | ||||
12 | Record(action.str_); | ||||
13 | } | ||||
14 | |||||
15 | void UserMetrics::RecordComputedAction(const std::string& action) { | ||||
16 | Record(action.c_str()); | ||||
17 | } | ||||
18 | |||||
19 | void UserMetrics::Record(const char *action) { | ||||
[email protected] | ca59d8a | 2010-12-23 01:22:04 | [diff] [blame] | 20 | if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
21 | BrowserThread::PostTask( | ||||
22 | BrowserThread::UI, FROM_HERE, | ||||
23 | NewRunnableFunction(&UserMetrics::CallRecordOnUI, action)); | ||||
24 | return; | ||||
25 | } | ||||
26 | |||||
[email protected] | 43211582 | 2011-07-10 15:52:27 | [diff] [blame] | 27 | NotificationService::current()->Notify(content::NOTIFICATION_USER_ACTION, |
[email protected] | 29cf1677 | 2010-04-21 15:13:47 | [diff] [blame] | 28 | NotificationService::AllSources(), |
[email protected] | 89622004 | 2010-03-23 18:14:28 | [diff] [blame] | 29 | Details<const char*>(&action)); |
30 | } | ||||
31 | |||||
[email protected] | ca59d8a | 2010-12-23 01:22:04 | [diff] [blame] | 32 | void UserMetrics::CallRecordOnUI(const std::string& action) { |
33 | Record(action.c_str()); | ||||
34 | } |