Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(657)

Unified Diff: third_party/analytics/externs.js

Issue 902813004: Add chrome platform analytics to third-party. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/analytics/externs.js
diff --git a/third_party/analytics/externs.js b/third_party/analytics/externs.js
new file mode 100644
index 0000000000000000000000000000000000000000..3995860f9ec8c3903ba8598a1d38cf30c4d0de22
--- /dev/null
+++ b/third_party/analytics/externs.js
@@ -0,0 +1,265 @@
+// Copyright (c) 2015 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.
+
+var goog = {};
+goog.async = {};
+
+/**
+ * @interface
+ * @template VALUE
+ */
+goog.async.Deferred;
+
+/**
+ * @param {!function(this:T,VALUE):?} cb
+ * @param {T=} opt_scope
+ * @return {!goog.async.Deferred}
+ * @template T
+ */
+goog.async.Deferred.prototype.addCallback;
+
+var analytics = {};
+
+/** @typedef {string} */
+analytics.HitType;
+
+/** @enum {analytics.HitType} */
+analytics.HitTypes = {
+ APPVIEW: 'appview',
+ EVENT: 'event',
+ SOCIAL: 'social',
+ TRANSACTION: 'transaction',
+ ITEM: 'item',
+ TIMING: 'timing',
+ EXCEPTION: 'exception'
+};
+
+/**
+ * @typedef {{
+ * id: string,
+ * name: string,
+ * valueType: analytics.ValueType,
+ * maxLength: (number|undefined),
+ * defaultValue: (string|undefined)
+ * }}
+ */
+analytics.Parameter;
+
+/** @typedef {string|number|boolean} */
+analytics.Value;
+
+/** @typedef {string} */
+analytics.ValueType;
+
+
+/**
+ * @param {string} appName
+ * @param {string=} opt_appVersion
+ * @return {!analytics.GoogleAnalytics}
+ */
+analytics.getService;
+
+
+/** @interface */
+analytics.GoogleAnalytics;
+
+/**
+ * @param {string} trackingId
+ * @return {!analytics.Tracker}
+ */
+analytics.GoogleAnalytics.prototype.getTracker;
+
+/** @return {!goog.async.Deferred.<!analytics.Config>} */
+analytics.GoogleAnalytics.prototype.getConfig;
+
+
+/** @interface */
+analytics.Tracker;
+
+/** @typedef {function(!analytics.Tracker.Hit)} */
+analytics.Tracker.Filter;
+
+/**
+ * @param {!analytics.HitType|!analytics.EventBuilder} hitType
+ * @param {(!analytics.ParameterMap|
+ * !Object.<string, !analytics.Value>)=} opt_extraParams
+ * @return {!goog.async.Deferred}
+ */
+analytics.Tracker.prototype.send;
+
+/**
+ * @param {string} description
+ * @return {!goog.async.Deferred}
+ */
+analytics.Tracker.prototype.sendAppView;
+
+/**
+ * @param {string} category
+ * @param {string} action
+ * @param {string=} opt_label
+ * @param {number=} opt_value
+ * @return {!goog.async.Deferred}
+ */
+analytics.Tracker.prototype.sendEvent;
+
+/**
+ * @param {string} network Specifies the social network, for example Facebook
+ * or Google Plus.
+ * @param {string} action Specifies the social interaction action.
+ * For example on Google Plus when a user clicks the +1 button,
+ * the social action is 'plus'.
+ * @param {string} target Specifies the target of a social interaction.
+ * This value is typically a URL but can be any text.
+ * @return {!goog.async.Deferred}
+ */
+analytics.Tracker.prototype.sendSocial;
+
+/**
+ * @param {string=} opt_description Specifies the description of an exception.
+ * @param {boolean=} opt_fatal Was the exception fatal.
+ * @return {!goog.async.Deferred}
+ */
+analytics.Tracker.prototype.sendException;
+
+/**
+ * @param {string} category Specifies the category of the timing.
+ * @param {string} variable Specifies the variable name of the timing.
+ * @param {number} value Specifies the value of the timing.
+ * @param {string=} opt_label Specifies the optional label of the timing.
+ * @param {number=} opt_sampleRate
+ * @return {!goog.async.Deferred}
+ */
+analytics.Tracker.prototype.sendTiming;
+
+analytics.Tracker.prototype.forceSessionStart;
+
+/**
+ * @param {string} category
+ * @param {string} variable
+ * @param {string=} opt_label
+ * @param {number=} opt_sampleRate
+ * @return {!analytics.Tracker.Timing}
+ */
+analytics.Tracker.prototype.startTiming;
+
+/** @interface */
+analytics.Tracker.Timing;
+
+/** @return {!goog.async.Deferred} */
+analytics.Tracker.Timing.prototype.send;
+
+/** @param {!analytics.Tracker.Filter} filter */
+analytics.Tracker.prototype.addFilter;
+
+/** @interface */
+analytics.Tracker.Hit;
+
+/** @return {!analytics.HitType} */
+analytics.Tracker.Hit.prototype.getHitType;
+
+/** @return {!analytics.ParameterMap} */
+analytics.Tracker.Hit.prototype.getParameters;
+
+analytics.Tracker.Hit.prototype.cancel;
+
+
+/** @interface */
+analytics.Config = function() {};
+
+/** @param {boolean} permitted */
+analytics.Config.prototype.setTrackingPermitted;
+
+/** @return {boolean} */
+analytics.Config.prototype.isTrackingPermitted;
+
+/** @param {number} sampleRate */
+analytics.Config.prototype.setSampleRate;
+
+
+/** @interface */
+analytics.ParameterMap;
+
+/**
+ * @typedef {{
+ * key: !analytics.Parameter,
+ * value: !analytics.Value
+ * }}
+ */
+analytics.ParameterMap.Entry;
+
+/**
+ * @param {!analytics.Parameter} param
+ * @param {!analytics.Value} value
+ */
+analytics.ParameterMap.prototype.set;
+
+/**
+ * @param {!analytics.Parameter} param
+ * @return {?analytics.Value}
+ */
+analytics.ParameterMap.prototype.get;
+
+/** @param {!analytics.Parameter} param */
+analytics.ParameterMap.prototype.remove;
+
+/** @return {!Object.<string, analytics.Value>} */
+analytics.ParameterMap.prototype.toObject;
+
+
+/** @interface */
+analytics.EventBuilder;
+
+/** @typedef {{ index: number, value: string }} */
+analytics.EventBuilder.Dimension;
+
+/** @typedef {{ index: number, value: number }} */
+analytics.EventBuilder.Metric;
+
+/** @return {!analytics.EventBuilder} */
+analytics.EventBuilder.builder;
+
+/**
+ * @param {string} category
+ * @return {!analytics.EventBuilder}
+ */
+analytics.EventBuilder.prototype.category;
+
+/**
+ * @param {string} action
+ * @return {!analytics.EventBuilder}
+ */
+analytics.EventBuilder.prototype.action;
+
+/**
+ * @param {string} label
+ * @return {!analytics.EventBuilder}
+ */
+analytics.EventBuilder.prototype.label;
+
+/**
+ * @param {number} value
+ * @return {!analytics.EventBuilder}
+ */
+analytics.EventBuilder.prototype.value;
+
+/**
+ * @param {!analytics.EventBuilder.Dimension} dimension
+ * @return {!analytics.EventBuilder}
+ */
+analytics.EventBuilder.prototype.dimension;
+
+/**
+ * @param {!analytics.EventBuilder.Metric} metric
+ * @return {!analytics.EventBuilder}
+ */
+analytics.EventBuilder.prototype.metric;
+
+/**
+ * @param {!analytics.Tracker} tracker
+ * @return {!goog.async.Deferred}
+ */
+analytics.EventBuilder.prototype.send;
+
+/** @param {!analytics.ParameterMap} parameters */
+analytics.EventBuilder.prototype.collect;

Powered by Google App Engine
This is Rietveld 408576698