[Extensions] Add metrics for UserScriptListener
[chromium-blink-merge.git] / ios / web / user_metrics.cc
blobb6ac484e6a7454b15aa60699725fa86625b3ecec
1 // Copyright 2014 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.
5 #include "ios/web/public/user_metrics.h"
7 #include <vector>
9 #include "base/bind.h"
10 #include "base/location.h"
11 #include "base/metrics/user_metrics.h"
12 #include "ios/web/public/web_thread.h"
14 namespace web {
16 void RecordAction(const base::UserMetricsAction& action) {
17 if (!WebThread::CurrentlyOn(WebThread::UI)) {
18 WebThread::PostTask(WebThread::UI, FROM_HERE,
19 base::Bind(&web::RecordAction, action));
20 return;
23 base::RecordAction(action);
26 void RecordComputedAction(const std::string& action) {
27 if (!WebThread::CurrentlyOn(WebThread::UI)) {
28 WebThread::PostTask(WebThread::UI, FROM_HERE,
29 base::Bind(&web::RecordComputedAction, action));
30 return;
33 base::RecordComputedAction(action);
36 } // namespace web