OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 (function(window) { | 5 (function(window) { |
6 | 6 |
7 // DevToolsAPI ---------------------------------------------------------------- | 7 // DevToolsAPI ---------------------------------------------------------------- |
8 | 8 |
9 /** | 9 /** |
10 * @constructor | 10 * @constructor |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 * @param {string} panelName | 295 * @param {string} panelName |
296 */ | 296 */ |
297 showPanel: function(panelName) | 297 showPanel: function(panelName) |
298 { | 298 { |
299 this._dispatchOnInspectorFrontendAPI("showPanel", [panelName]); | 299 this._dispatchOnInspectorFrontendAPI("showPanel", [panelName]); |
300 }, | 300 }, |
301 | 301 |
302 /** | 302 /** |
303 * @param {number} id | 303 * @param {number} id |
304 * @param {string} chunk | 304 * @param {string} chunk |
| 305 * @param {boolean} encoded |
305 */ | 306 */ |
306 streamWrite: function(id, chunk) | 307 streamWrite: function(id, chunk, encoded) |
307 { | 308 { |
308 this._dispatchOnInspectorFrontendAPI("streamWrite", [id, chunk]); | 309 this._dispatchOnInspectorFrontendAPI("streamWrite", [id, encoded ? this.
_decodeBase64(chunk) : chunk]); |
| 310 }, |
| 311 |
| 312 /** |
| 313 * @param {string} chunk |
| 314 * @return {string} |
| 315 */ |
| 316 _decodeBase64: function(chunk) |
| 317 { |
| 318 var request = new XMLHttpRequest(); |
| 319 request.open("GET", "data:text/plain;base64," + chunk, false); |
| 320 request.send(null); |
| 321 if (request.status === 200) { |
| 322 return request.responseText; |
| 323 } else { |
| 324 console.error("Error while decoding chunk in streamWrite"); |
| 325 return ""; |
| 326 } |
309 } | 327 } |
310 } | 328 } |
311 | 329 |
312 var DevToolsAPI = new DevToolsAPIImpl(); | 330 var DevToolsAPI = new DevToolsAPIImpl(); |
313 window.DevToolsAPI = DevToolsAPI; | 331 window.DevToolsAPI = DevToolsAPI; |
314 | 332 |
315 // InspectorFrontendHostImpl -------------------------------------------------- | 333 // InspectorFrontendHostImpl -------------------------------------------------- |
316 | 334 |
317 /** | 335 /** |
318 * @constructor | 336 * @constructor |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 | 1069 |
1052 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) { | 1070 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) { |
1053 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype
.toggle; | 1071 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype
.toggle; |
1054 DOMTokenList.prototype.toggle = function(token, force) | 1072 DOMTokenList.prototype.toggle = function(token, force) |
1055 { | 1073 { |
1056 if (arguments.length === 1) | 1074 if (arguments.length === 1) |
1057 force = !this.contains(token); | 1075 force = !this.contains(token); |
1058 return this.__originalDOMTokenListToggle(token, !!force); | 1076 return this.__originalDOMTokenListToggle(token, !!force); |
1059 } | 1077 } |
1060 } | 1078 } |
OLD | NEW |