1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_METRICS_PRIVATE_METRICS_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_METRICS_PRIVATE_METRICS_PRIVATE_API_H_
10 #include "base/metrics/histogram.h"
11 #include "extensions/browser/extension_function.h"
13 namespace extensions
{
15 class MetricsPrivateGetIsCrashReportingEnabledFunction
16 : public SyncExtensionFunction
{
18 DECLARE_EXTENSION_FUNCTION("metricsPrivate.getIsCrashReportingEnabled",
19 METRICSPRIVATE_GETISCRASHRECORDINGENABLED
)
22 ~MetricsPrivateGetIsCrashReportingEnabledFunction() override
{}
25 bool RunSync() override
;
28 class MetricsPrivateGetFieldTrialFunction
: public SyncExtensionFunction
{
30 DECLARE_EXTENSION_FUNCTION("metricsPrivate.getFieldTrial",
31 METRICSPRIVATE_GETFIELDTRIAL
)
34 ~MetricsPrivateGetFieldTrialFunction() override
{}
37 bool RunSync() override
;
40 class MetricsPrivateGetVariationParamsFunction
: public SyncExtensionFunction
{
42 DECLARE_EXTENSION_FUNCTION("metricsPrivate.getVariationParams",
43 METRICSPRIVATE_GETVARIATIONPARAMS
)
46 ~MetricsPrivateGetVariationParamsFunction() override
{}
49 bool RunSync() override
;
52 class MetricsPrivateRecordUserActionFunction
: public SyncExtensionFunction
{
54 DECLARE_EXTENSION_FUNCTION("metricsPrivate.recordUserAction",
55 METRICSPRIVATE_RECORDUSERACTION
)
58 ~MetricsPrivateRecordUserActionFunction() override
{}
61 bool RunSync() override
;
64 class MetricsHistogramHelperFunction
: public SyncExtensionFunction
{
66 ~MetricsHistogramHelperFunction() override
{}
67 virtual bool RecordValue(const std::string
& name
,
68 base::HistogramType type
,
69 int min
, int max
, size_t buckets
,
73 class MetricsPrivateRecordValueFunction
74 : public MetricsHistogramHelperFunction
{
76 DECLARE_EXTENSION_FUNCTION("metricsPrivate.recordValue",
77 METRICSPRIVATE_RECORDVALUE
)
80 ~MetricsPrivateRecordValueFunction() override
{}
83 bool RunSync() override
;
86 class MetricsPrivateRecordSparseValueFunction
87 : public MetricsHistogramHelperFunction
{
89 DECLARE_EXTENSION_FUNCTION("metricsPrivate.recordSparseValue",
90 METRICSPRIVATE_RECORDSPARSEVALUE
)
93 ~MetricsPrivateRecordSparseValueFunction() override
{}
96 bool RunSync() override
;
99 class MetricsPrivateRecordPercentageFunction
100 : public MetricsHistogramHelperFunction
{
102 DECLARE_EXTENSION_FUNCTION("metricsPrivate.recordPercentage",
103 METRICSPRIVATE_RECORDPERCENTAGE
)
106 ~MetricsPrivateRecordPercentageFunction() override
{}
108 // ExtensionFunction:
109 bool RunSync() override
;
112 class MetricsPrivateRecordCountFunction
113 : public MetricsHistogramHelperFunction
{
115 DECLARE_EXTENSION_FUNCTION("metricsPrivate.recordCount",
116 METRICSPRIVATE_RECORDCOUNT
)
119 ~MetricsPrivateRecordCountFunction() override
{}
121 // ExtensionFunction:
122 bool RunSync() override
;
125 class MetricsPrivateRecordSmallCountFunction
126 : public MetricsHistogramHelperFunction
{
128 DECLARE_EXTENSION_FUNCTION("metricsPrivate.recordSmallCount",
129 METRICSPRIVATE_RECORDSMALLCOUNT
)
132 ~MetricsPrivateRecordSmallCountFunction() override
{}
134 // ExtensionFunction:
135 bool RunSync() override
;
138 class MetricsPrivateRecordMediumCountFunction
139 : public MetricsHistogramHelperFunction
{
141 DECLARE_EXTENSION_FUNCTION("metricsPrivate.recordMediumCount",
142 METRICSPRIVATE_RECORDMEDIUMCOUNT
)
145 ~MetricsPrivateRecordMediumCountFunction() override
{}
147 // ExtensionFunction:
148 bool RunSync() override
;
151 class MetricsPrivateRecordTimeFunction
: public MetricsHistogramHelperFunction
{
153 DECLARE_EXTENSION_FUNCTION("metricsPrivate.recordTime",
154 METRICSPRIVATE_RECORDTIME
)
157 ~MetricsPrivateRecordTimeFunction() override
{}
159 // ExtensionFunction:
160 bool RunSync() override
;
163 class MetricsPrivateRecordMediumTimeFunction
164 : public MetricsHistogramHelperFunction
{
166 DECLARE_EXTENSION_FUNCTION("metricsPrivate.recordMediumTime",
167 METRICSPRIVATE_RECORDMEDIUMTIME
)
170 ~MetricsPrivateRecordMediumTimeFunction() override
{}
172 // ExtensionFunction:
173 bool RunSync() override
;
176 class MetricsPrivateRecordLongTimeFunction
177 : public MetricsHistogramHelperFunction
{
179 DECLARE_EXTENSION_FUNCTION("metricsPrivate.recordLongTime",
180 METRICSPRIVATE_RECORDLONGTIME
)
183 ~MetricsPrivateRecordLongTimeFunction() override
{}
185 // ExtensionFunction:
186 bool RunSync() override
;
189 } // namespace extensions
191 #endif // CHROME_BROWSER_EXTENSIONS_API_METRICS_PRIVATE_METRICS_PRIVATE_API_H_