summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_metrics_module.h
blob: 81e12be2ce354c7de1199e5def0f80ba15003663 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_METRICS_MODULE_H__
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_METRICS_MODULE_H__

#include <string>

#include "base/histogram.h"
#include "chrome/browser/extensions/extension_function.h"

class MetricsRecordUserActionFunction : public SyncExtensionFunction {
  virtual bool RunImpl();
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordUserAction")
};

class MetricsHistogramHelperFunction : public SyncExtensionFunction {
 protected:
  bool GetNameAndSample(std::string* name, int* sample);
  virtual bool RecordValue(const std::string& name, Histogram::ClassType type,
      int min, int max, size_t buckets, int sample);
};

class MetricsRecordValueFunction : public MetricsHistogramHelperFunction {
  virtual bool RunImpl();
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordValue")
};

class MetricsRecordPercentageFunction : public MetricsHistogramHelperFunction {
  virtual bool RunImpl();
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordPercentage")
};

class MetricsRecordCountFunction : public MetricsHistogramHelperFunction {
  virtual bool RunImpl();
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordCount")
};

class MetricsRecordSmallCountFunction : public MetricsHistogramHelperFunction {
  virtual bool RunImpl();
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordSmallCount")
};

class MetricsRecordMediumCountFunction : public MetricsHistogramHelperFunction {
  virtual bool RunImpl();
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordMediumCount")
};

class MetricsRecordTimeFunction : public MetricsHistogramHelperFunction {
  virtual bool RunImpl();
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordTime")
};

class MetricsRecordMediumTimeFunction : public MetricsHistogramHelperFunction {
  virtual bool RunImpl();
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordMediumTime")
};

class MetricsRecordLongTimeFunction : public MetricsHistogramHelperFunction {
  virtual bool RunImpl();
  DECLARE_EXTENSION_FUNCTION_NAME("experimental.metrics.recordLongTime")
};

#endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_METRICS_MODULE_H__