summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-26 18:08:43 +0000
committerrogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-26 18:08:43 +0000
commit438772df5a7055847d061d49a8c18e6fc77daedb (patch)
treec748b7ff544f07d888a6978cac99c7c1b5d261b6 /chrome/common
parent46ef2ce78952914d3723b07aae28b024a1e8a6ad (diff)
downloadchromium_src-438772df5a7055847d061d49a8c18e6fc77daedb.zip
chromium_src-438772df5a7055847d061d49a8c18e6fc77daedb.tar.gz
chromium_src-438772df5a7055847d061d49a8c18e6fc77daedb.tar.bz2
Add a metrics extensions API.
See http://docs.google.com/View?id=dd4ngnpz_0dpsb8n96 for API proposal. BUG=0 TEST=See unit tests as part of this CL Review URL: http://codereview.chromium.org/657037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40130 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/chrome_switches.cc3
-rw-r--r--chrome/common/chrome_switches.h1
-rwxr-xr-xchrome/common/extensions/api/extension_api.json105
3 files changed, 109 insertions, 0 deletions
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 7d16f0e..29e22c4 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -207,6 +207,9 @@ const char kEnableBenchmarking[] = "enable-benchmarking";
const char kEnableExperimentalExtensionApis[] =
"enable-experimental-extension-apis";
+// Enable metrics extension API.
+const char kEnableMetricsExtensionApi[] = "enable-metrics-extension-api";
+
// Enable experimental WebGL support.
const char kEnableExperimentalWebGL[] = "enable-webgl";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 89aa2b0..5ab8178 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -74,6 +74,7 @@ extern const char kDomAutomationController[];
extern const char kDumpHistogramsOnExit[];
extern const char kEnableBenchmarking[];
extern const char kEnableExperimentalExtensionApis[];
+extern const char kEnableMetricsExtensionApi[];
extern const char kEnableExperimentalWebGL[];
extern const char kEnableExtensionApps[];
extern const char kEnableExtensionTimelineApi[];
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json
index 58894e4..cf28b4f 100755
--- a/chrome/common/extensions/api/extension_api.json
+++ b/chrome/common/extensions/api/extension_api.json
@@ -2256,6 +2256,111 @@
"events": []
},
{
+ "namespace": "metrics",
+ "types": [
+ {
+ "id": "MetricType",
+ "type": "object",
+ "description": "Describes the type of metric that is to be collected.",
+ "properties": {
+ "metricName": {"type": "string", "description": "A unique name within the extension for the metric."},
+ "type": {
+ "type": "string",
+ "enum": ["histogram-log", "histogram-linear"],
+ "description": "The type of metric, such as 'histogram-log' or 'histogram-linear'."
+ },
+ "min": {"type": "integer", "description": "The minimum sample value to be recoded. Must be greater than zero."},
+ "max": {"type": "integer", "description": "The maximum sample value to be recoded."},
+ "buckets": {"type": "integer", "description": "The number of buckets to use when separating the recorded values."}
+ }
+ }
+ ],
+ "functions": [
+ {
+ "name": "recordUserAction",
+ "type": "function",
+ "description": "Records an action performed by the user.",
+ "parameters": [
+ {"name": "name", "type": "string"}
+ ]
+ },
+ {
+ "name": "recordPercentage",
+ "type": "function",
+ "description": "Record a percentage value from 1 to 100.",
+ "parameters": [
+ {"name": "metricName", "type": "string"},
+ {"name": "value", "type": "integer"}
+ ]
+ },
+ {
+ "name": "recordCount",
+ "type": "function",
+ "description": "Record a value than can range from 1 to 1,000,000.",
+ "parameters": [
+ {"name": "metricName", "type": "string"},
+ {"name": "value", "type": "integer"}
+ ]
+ },
+ {
+ "name": "recordSmallCount",
+ "type": "function",
+ "description": "Record a value than can range from 1 to 100.",
+ "parameters": [
+ {"name": "metricName", "type": "string"},
+ {"name": "value", "type": "integer"}
+ ]
+ },
+ {
+ "name": "recordMediumCount",
+ "type": "function",
+ "description": "Record a value than can range from 1 to 10,000.",
+ "parameters": [
+ {"name": "metricName", "type": "string"},
+ {"name": "value", "type": "integer"}
+ ]
+ },
+ {
+ "name": "recordTime",
+ "type": "function",
+ "description": "Record an elapsed time of no more than 10 seconds. The sample value is specified in milliseconds.",
+ "parameters": [
+ {"name": "metricName", "type": "string"},
+ {"name": "value", "type": "integer"}
+ ]
+ },
+ {
+ "name": "recordMediumTime",
+ "type": "function",
+ "description": "Record an elapsed time of no more than 3 minutes. The sample value is specified in milliseconds.",
+ "parameters": [
+ {"name": "metricName", "type": "string"},
+ {"name": "value", "type": "integer"}
+ ]
+ },
+ {
+ "name": "recordLongTime",
+ "type": "function",
+ "description": "Record an elapsed time of no more than 1 hour. The sample value is specified in milliseconds.",
+ "parameters": [
+ {"name": "metricName", "type": "string"},
+ {"name": "value", "type": "integer"}
+ ]
+ },
+ {
+ "name": "recordValue",
+ "type": "function",
+ "unprivileged": true,
+ "description": "Adds a value to the given metric.",
+ "parameters": [
+ {"name": "metric", "$ref": "MetricType"},
+ {"name": "value", "type": "integer"}
+ ]
+ }
+ ],
+ "events": []
+ },
+ {
"namespace": "test",
"nodoc": true,
"types": [],