OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // TODO(eroman): put these methods into a namespace. | 5 // TODO(eroman): put these methods into a namespace. |
6 | 6 |
7 var printLogEntriesAsText; | 7 var printLogEntriesAsText; |
8 var proxySettingsToString; | 8 var proxySettingsToString; |
9 var stripCookiesAndLoginInfo; | 9 var stripCookiesAndLoginInfo; |
10 | 10 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 * | 235 * |
236 * @return {function} The returned function "writer" can be invoked | 236 * @return {function} The returned function "writer" can be invoked |
237 * as |writer(entry, writer, consumedParams)|. It will | 237 * as |writer(entry, writer, consumedParams)|. It will |
238 * output the parameters of |entry| to |out|, and fill | 238 * output the parameters of |entry| to |out|, and fill |
239 * |consumedParams| with the keys of the parameters | 239 * |consumedParams| with the keys of the parameters |
240 * consumed. If no writer is available for |eventType| then | 240 * consumed. If no writer is available for |eventType| then |
241 * returns null. | 241 * returns null. |
242 */ | 242 */ |
243 function getParamaterWriterForEventType(eventType) { | 243 function getParamaterWriterForEventType(eventType) { |
244 switch (eventType) { | 244 switch (eventType) { |
245 case LogEventType.HTTP_TRANSACTION_SEND_REQUEST_HEADERS: | 245 case EventType.HTTP_TRANSACTION_SEND_REQUEST_HEADERS: |
246 case LogEventType.HTTP_TRANSACTION_SEND_TUNNEL_HEADERS: | 246 case EventType.HTTP_TRANSACTION_SEND_TUNNEL_HEADERS: |
247 return writeParamsForRequestHeaders; | 247 return writeParamsForRequestHeaders; |
248 | 248 |
249 case LogEventType.PROXY_CONFIG_CHANGED: | 249 case EventType.PROXY_CONFIG_CHANGED: |
250 return writeParamsForProxyConfigChanged; | 250 return writeParamsForProxyConfigChanged; |
251 | 251 |
252 case LogEventType.CERT_VERIFIER_JOB: | 252 case EventType.CERT_VERIFIER_JOB: |
253 case LogEventType.SSL_CERTIFICATES_RECEIVED: | 253 case EventType.SSL_CERTIFICATES_RECEIVED: |
254 return writeParamsForCertificates; | 254 return writeParamsForCertificates; |
255 | 255 |
256 case LogEventType.SSL_VERSION_FALLBACK: | 256 case EventType.SSL_VERSION_FALLBACK: |
257 return writeParamsForSSLVersionFallback; | 257 return writeParamsForSSLVersionFallback; |
258 } | 258 } |
259 return null; | 259 return null; |
260 } | 260 } |
261 | 261 |
262 /** | 262 /** |
263 * Default parameter writer that outputs a visualization of field named |key| | 263 * Default parameter writer that outputs a visualization of field named |key| |
264 * with value |value| to |out|. | 264 * with value |value| to |out|. |
265 */ | 265 */ |
266 function defaultWriteParameter(key, value, out) { | 266 function defaultWriteParameter(key, value, out) { |
267 if (key == 'headers' && value instanceof Array) { | 267 if (key == 'headers' && value instanceof Array) { |
268 out.writeArrowIndentedLines(value); | 268 out.writeArrowIndentedLines(value); |
269 return; | 269 return; |
270 } | 270 } |
271 | 271 |
272 // For transferred bytes, display the bytes in hex and ASCII. | 272 // For transferred bytes, display the bytes in hex and ASCII. |
273 if (key == 'hex_encoded_bytes' && typeof value == 'string') { | 273 if (key == 'hex_encoded_bytes' && typeof value == 'string') { |
274 out.writeArrowKey(key); | 274 out.writeArrowKey(key); |
275 writeHexString(value, 20, out); | 275 writeHexString(value, 20, out); |
276 return; | 276 return; |
277 } | 277 } |
278 | 278 |
279 // Handle source_dependency entries - add link and map source type to | 279 // Handle source_dependency entries - add link and map source type to |
280 // string. | 280 // string. |
281 if (key == 'source_dependency' && typeof value == 'object') { | 281 if (key == 'source_dependency' && typeof value == 'object') { |
282 var link = '#events&s=' + value.id; | 282 var link = '#events&s=' + value.id; |
283 var valueStr = value.id + ' (' + LogSourceTypeNames[value.type] + ')'; | 283 var valueStr = value.id + ' (' + EventSourceTypeNames[value.type] + ')'; |
284 out.writeArrowKeyValue(key, valueStr, link); | 284 out.writeArrowKeyValue(key, valueStr, link); |
285 return; | 285 return; |
286 } | 286 } |
287 | 287 |
288 if (key == 'net_error' && typeof value == 'number') { | 288 if (key == 'net_error' && typeof value == 'number') { |
289 var valueStr = value + ' (' + netErrorToString(value) + ')'; | 289 var valueStr = value + ' (' + netErrorToString(value) + ')'; |
290 out.writeArrowKeyValue(key, valueStr); | 290 out.writeArrowKeyValue(key, valueStr); |
291 return; | 291 return; |
292 } | 292 } |
293 | 293 |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 // Don't prefix with '+' if we are going to collapse the END event. | 530 // Don't prefix with '+' if we are going to collapse the END event. |
531 text = ' '; | 531 text = ' '; |
532 } else if (entry.isBegin()) { | 532 } else if (entry.isBegin()) { |
533 text = '+' + text; | 533 text = '+' + text; |
534 } else if (entry.isEnd()) { | 534 } else if (entry.isEnd()) { |
535 text = '-' + text; | 535 text = '-' + text; |
536 } else { | 536 } else { |
537 text = ' '; | 537 text = ' '; |
538 } | 538 } |
539 | 539 |
540 text += LogEventTypeNames[entry.orig.type]; | 540 text += EventTypeNames[entry.orig.type]; |
541 return text; | 541 return text; |
542 } | 542 } |
543 | 543 |
544 proxySettingsToString = function(config) { | 544 proxySettingsToString = function(config) { |
545 if (!config) | 545 if (!config) |
546 return ''; | 546 return ''; |
547 | 547 |
548 // The proxy settings specify up to three major fallback choices | 548 // The proxy settings specify up to three major fallback choices |
549 // (auto-detect, custom pac url, or manual settings). | 549 // (auto-detect, custom pac url, or manual settings). |
550 // We enumerate these to a list so we can later number them. | 550 // We enumerate these to a list so we can later number them. |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 var result = []; | 603 var result = []; |
604 for (var i = 0; i < modes.length; ++i) | 604 for (var i = 0; i < modes.length; ++i) |
605 result.push(indentLines('(' + (i + 1) + ') ', modes[i])); | 605 result.push(indentLines('(' + (i + 1) + ') ', modes[i])); |
606 | 606 |
607 return result.join('\n'); | 607 return result.join('\n'); |
608 }; | 608 }; |
609 | 609 |
610 // End of anonymous namespace. | 610 // End of anonymous namespace. |
611 })(); | 611 })(); |
612 | 612 |
OLD | NEW |