Home | History | Annotate | Download | only in browser
      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/public/browser/user_metrics.h"
      6 
      7 #include <vector>
      8 
      9 #include "base/bind.h"
     10 #include "base/metrics/user_metrics.h"
     11 #include "content/public/browser/browser_thread.h"
     12 
     13 namespace content {
     14 
     15 void RecordAction(const base::UserMetricsAction& action) {
     16   if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
     17     BrowserThread::PostTask(
     18         BrowserThread::UI,
     19         FROM_HERE,
     20         base::Bind(&RecordAction, action));
     21     return;
     22   }
     23 
     24   base::RecordAction(action);
     25 }
     26 
     27 void RecordComputedAction(const std::string& action) {
     28   if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
     29     BrowserThread::PostTask(
     30         BrowserThread::UI,
     31         FROM_HERE,
     32         base::Bind(&RecordComputedAction, action));
     33     return;
     34   }
     35 
     36   base::RecordComputedAction(action);
     37 }
     38 
     39 }  // namespace content
     40