| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include "content/browser/user_metrics.h" | |
| 6 | |
| 7 #include "base/bind.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" | |
| 11 | |
| 12 using content::BrowserThread; | |
| 13 | |
| 14 void UserMetrics::RecordAction(const UserMetricsAction& action) { | |
| 15 Record(action.str_); | |
| 16 } | |
| 17 | |
| 18 void UserMetrics::RecordComputedAction(const std::string& action) { | |
| 19 Record(action.c_str()); | |
| 20 } | |
| 21 | |
| 22 void UserMetrics::Record(const char *action) { | |
| 23 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | |
| 24 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | |
| 25 base::Bind(&UserMetrics::CallRecordOnUI, action)); | |
| 26 return; | |
| 27 } | |
| 28 | |
| 29 content::NotificationService::current()->Notify( | |
| 30 content::NOTIFICATION_USER_ACTION, | |
| 31 content::NotificationService::AllSources(), | |
| 32 content::Details<const char*>(&action)); | |
| 33 } | |
| 34 | |
| 35 void UserMetrics::CallRecordOnUI(const std::string& action) { | |
| 36 Record(action.c_str()); | |
| 37 } | |
| OLD | NEW |