| 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/common/notification_service.h" |
| 9 | 9 |
| 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(NotificationType::USER_ACTION, | 27 NotificationService::current()->Notify(content::NOTIFICATION_USER_ACTION, |
| 28 NotificationService::AllSources(), | 28 NotificationService::AllSources(), |
| 29 Details<const char*>(&action)); | 29 Details<const char*>(&action)); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void UserMetrics::CallRecordOnUI(const std::string& action) { | 32 void UserMetrics::CallRecordOnUI(const std::string& action) { |
| 33 Record(action.c_str()); | 33 Record(action.c_str()); |
| 34 } | 34 } |
| OLD | NEW |