chrome.js (3234B)
1 /* 2 * Copyright 2013 The Closure Compiler Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** 18 * @fileoverview Definitions for globals in Chrome. This file describes the 19 * externs API for the chrome.* object when running in a normal browser 20 * context. For APIs available in Chrome Extensions, see chrome_extensions.js 21 * in this directory. 22 * @externs 23 */ 24 25 26 /** 27 * namespace 28 * @const 29 */ 30 var chrome = {}; 31 32 33 34 /** 35 * Returns an object representing current load times. Note that the properties 36 * on the object do not change and the function must be called again to get 37 * up-to-date data. 38 * 39 * @see http://goto.google.com/chromeloadtimesextension 40 * 41 * @return {!ChromeLoadTimes} 42 */ 43 chrome.loadTimes = function() {}; 44 45 46 47 /** 48 * The data object given by chrome.loadTimes(). 49 * @constructor 50 */ 51 function ChromeLoadTimes() {} 52 53 54 /** @type {number} */ 55 ChromeLoadTimes.prototype.requestTime; 56 57 58 /** @type {number} */ 59 ChromeLoadTimes.prototype.startLoadTime; 60 61 62 /** @type {number} */ 63 ChromeLoadTimes.prototype.commitLoadTime; 64 65 66 /** @type {number} */ 67 ChromeLoadTimes.prototype.finishDocumentLoadTime; 68 69 70 /** @type {number} */ 71 ChromeLoadTimes.prototype.finishLoadTime; 72 73 74 /** @type {number} */ 75 ChromeLoadTimes.prototype.firstPaintTime; 76 77 78 /** @type {number} */ 79 ChromeLoadTimes.prototype.firstPaintAfterLoadTime; 80 81 82 /** @type {number} */ 83 ChromeLoadTimes.prototype.navigationType; 84 85 86 /** 87 * True iff the resource was fetched over SPDY. 88 * @type {boolean} 89 */ 90 ChromeLoadTimes.prototype.wasFetchedViaSpdy; 91 92 93 /** @type {boolean} */ 94 ChromeLoadTimes.prototype.wasNpnNegotiated; 95 96 97 /** @type {string} */ 98 ChromeLoadTimes.prototype.npnNegotiatedProtocol; 99 100 101 /** @type {boolean} */ 102 ChromeLoadTimes.prototype.wasAlternateProtocolAvailable; 103 104 105 /** @type {string} */ 106 ChromeLoadTimes.prototype.connectionInfo; 107 108 109 /** 110 * Returns an object containing timing information. 111 * @return {!ChromeCsiInfo} 112 */ 113 chrome.csi = function() {}; 114 115 116 117 /** 118 * The data object given by chrome.csi(). 119 * @constructor 120 */ 121 function ChromeCsiInfo() {} 122 123 124 /** 125 * Same as chrome.loadTimes().requestTime, if defined. 126 * Otherwise, gives the same value as chrome.loadTimes().startLoadTime. 127 * In milliseconds, truncated. 128 * @type {number} 129 */ 130 ChromeCsiInfo.prototype.startE; 131 132 133 /** 134 * Same as chrome.loadTimes().finishDocumentLoadTime but in milliseconds and 135 * truncated. 136 * @type {number} 137 */ 138 ChromeCsiInfo.prototype.onloadT; 139 140 141 /** 142 * The time since startE in milliseconds. 143 * @type {number} 144 */ 145 ChromeCsiInfo.prototype.pageT; 146 147 148 /** @type {number} */ 149 ChromeCsiInfo.prototype.tran; 150 151 152 /** 153 * @param {string|!ArrayBuffer|!Object} message 154 * @see https://developers.google.com/native-client/devguide/tutorial 155 */ 156 HTMLEmbedElement.prototype.postMessage = function(message) {};