OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/user_metrics.h" | 5 #include "content/browser/user_metrics.h" |
6 | 6 |
7 #include "content/browser/browser_thread.h" | 7 #include "content/browser/browser_thread.h" |
8 #include "content/common/notification_service.h" | 8 #include "content/public/browser/notification_service.h" |
9 #include "content/public/browser/notification_types.h" | 9 #include "content/public/browser/notification_types.h" |
10 | 10 |
11 void UserMetrics::RecordAction(const UserMetricsAction& action) { | 11 void UserMetrics::RecordAction(const UserMetricsAction& action) { |
12 Record(action.str_); | 12 Record(action.str_); |
13 } | 13 } |
14 | 14 |
15 void UserMetrics::RecordComputedAction(const std::string& action) { | 15 void UserMetrics::RecordComputedAction(const std::string& action) { |
16 Record(action.c_str()); | 16 Record(action.c_str()); |
17 } | 17 } |
18 | 18 |
19 void UserMetrics::Record(const char *action) { | 19 void UserMetrics::Record(const char *action) { |
20 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 20 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
21 BrowserThread::PostTask( | 21 BrowserThread::PostTask( |
22 BrowserThread::UI, FROM_HERE, | 22 BrowserThread::UI, FROM_HERE, |
23 NewRunnableFunction(&UserMetrics::CallRecordOnUI, action)); | 23 NewRunnableFunction(&UserMetrics::CallRecordOnUI, action)); |
24 return; | 24 return; |
25 } | 25 } |
26 | 26 |
27 NotificationService::current()->Notify( | 27 content::NotificationService::current()->Notify( |
28 content::NOTIFICATION_USER_ACTION, | 28 content::NOTIFICATION_USER_ACTION, |
29 NotificationService::AllSources(), | 29 content::NotificationService::AllSources(), |
30 content::Details<const char*>(&action)); | 30 content::Details<const char*>(&action)); |
31 } | 31 } |
32 | 32 |
33 void UserMetrics::CallRecordOnUI(const std::string& action) { | 33 void UserMetrics::CallRecordOnUI(const std::string& action) { |
34 Record(action.c_str()); | 34 Record(action.c_str()); |
35 } | 35 } |
OLD | NEW |