OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 /** | 5 /** |
6 * This view displays options for importing/exporting the captured data. Its | 6 * This view displays options for importing/exporting the captured data. Its |
7 * primarily usefulness is to allow users to copy-paste their data in an easy | 7 * primarily usefulness is to allow users to copy-paste their data in an easy |
8 * to read format for bug reports. | 8 * to read format for bug reports. |
9 * | 9 * |
10 * - Has a button to generate a text report. | 10 * - Has a button to generate a text report. |
11 * | 11 * |
12 * - Shows how many events have been captured. | 12 * - Shows how many events have been captured. |
13 * @constructor | 13 * @constructor |
14 */ | 14 */ |
15 function DataView(mainBoxId, | 15 function DataView(mainBoxId, |
16 outputTextBoxId, | 16 outputTextBoxId, |
17 exportTextButtonId, | 17 exportTextButtonId, |
18 securityStrippingCheckboxId, | 18 securityStrippingCheckboxId, |
19 byteLoggingCheckboxId, | 19 byteLoggingCheckboxId, |
20 passivelyCapturedCountId, | 20 passivelyCapturedCountId, |
21 activelyCapturedCountId, | 21 activelyCapturedCountId, |
22 deleteAllId, | 22 deleteAllId, |
23 dumpDataDivId, | 23 dumpDataDivId, |
24 loadDataDivId, | 24 loadDataDivId, |
25 loadLogFileId, | 25 loadLogFileId, |
26 capturingTextSpanId, | 26 capturingTextSpanId, |
27 loggingTextSpanId) { | 27 loggingTextSpanId) { |
28 DivView.call(this, mainBoxId); | 28 DivView.call(this, mainBoxId); |
29 | 29 |
30 this.textPre_ = document.getElementById(outputTextBoxId); | 30 this.textPre_ = document.getElementById(outputTextBoxId); |
31 this.securityStrippingCheckbox_ = | 31 |
| 32 var securityStrippingCheckbox = |
32 document.getElementById(securityStrippingCheckboxId); | 33 document.getElementById(securityStrippingCheckboxId); |
| 34 securityStrippingCheckbox.onclick = |
| 35 this.onSetSecurityStripping_.bind(this, securityStrippingCheckbox); |
33 | 36 |
34 var byteLoggingCheckbox = document.getElementById(byteLoggingCheckboxId); | 37 var byteLoggingCheckbox = document.getElementById(byteLoggingCheckboxId); |
35 byteLoggingCheckbox.onclick = | 38 byteLoggingCheckbox.onclick = |
36 this.onSetByteLogging_.bind(this, byteLoggingCheckbox); | 39 this.onSetByteLogging_.bind(this, byteLoggingCheckbox); |
37 | 40 |
38 var exportTextButton = document.getElementById(exportTextButtonId); | 41 var exportTextButton = document.getElementById(exportTextButtonId); |
39 exportTextButton.onclick = this.onExportToText_.bind(this); | 42 exportTextButton.onclick = this.onExportToText_.bind(this); |
40 | 43 |
41 this.activelyCapturedCountBox_ = | 44 this.activelyCapturedCountBox_ = |
42 document.getElementById(activelyCapturedCountId); | 45 document.getElementById(activelyCapturedCountId); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 */ | 114 */ |
112 DataView.prototype.onSetByteLogging_ = function(byteLoggingCheckbox) { | 115 DataView.prototype.onSetByteLogging_ = function(byteLoggingCheckbox) { |
113 if (byteLoggingCheckbox.checked) { | 116 if (byteLoggingCheckbox.checked) { |
114 g_browser.setLogLevel(LogLevelType.LOG_ALL); | 117 g_browser.setLogLevel(LogLevelType.LOG_ALL); |
115 } else { | 118 } else { |
116 g_browser.setLogLevel(LogLevelType.LOG_ALL_BUT_BYTES); | 119 g_browser.setLogLevel(LogLevelType.LOG_ALL_BUT_BYTES); |
117 } | 120 } |
118 }; | 121 }; |
119 | 122 |
120 /** | 123 /** |
| 124 * Depending on the value of the checkbox, enables or disables stripping |
| 125 * cookies and passwords from log dumps and displayed events. |
| 126 */ |
| 127 DataView.prototype.onSetSecurityStripping_ = |
| 128 function(securityStrippingCheckbox) { |
| 129 g_browser.setSecurityStripping(securityStrippingCheckbox.checked); |
| 130 }; |
| 131 |
| 132 /** |
| 133 * Clears displayed text when security stripping is toggled. |
| 134 */ |
| 135 DataView.prototype.onSecurityStrippingChanged = function() { |
| 136 this.setText_(''); |
| 137 } |
| 138 |
| 139 /** |
121 * If not already waiting for results from all updates, triggers all | 140 * If not already waiting for results from all updates, triggers all |
122 * updates and starts waiting for them to complete. | 141 * updates and starts waiting for them to complete. |
123 */ | 142 */ |
124 DataView.prototype.onExportToText_ = function() { | 143 DataView.prototype.onExportToText_ = function() { |
125 if (this.waitingForUpdate_) | 144 if (this.waitingForUpdate_) |
126 return; | 145 return; |
127 this.waitingForUpdate = true; | 146 this.waitingForUpdate = true; |
128 this.setText_('Generating...'); | 147 this.setText_('Generating...'); |
129 g_browser.updateAllInfo(this.onUpdateAllCompleted.bind(this)); | 148 g_browser.updateAllInfo(this.onUpdateAllCompleted.bind(this)); |
130 }; | 149 }; |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 var sourceType = eventList[0].source.type; | 421 var sourceType = eventList[0].source.type; |
403 | 422 |
404 var startDate = g_browser.convertTimeTicksToDate(eventList[0].time); | 423 var startDate = g_browser.convertTimeTicksToDate(eventList[0].time); |
405 | 424 |
406 out.push('------------------------------------------'); | 425 out.push('------------------------------------------'); |
407 out.push(getKeyWithValue(LogSourceType, sourceType) + | 426 out.push(getKeyWithValue(LogSourceType, sourceType) + |
408 ' (id=' + sourceId + ')' + | 427 ' (id=' + sourceId + ')' + |
409 ' [start=' + startDate.toLocaleString() + ']'); | 428 ' [start=' + startDate.toLocaleString() + ']'); |
410 out.push('------------------------------------------'); | 429 out.push('------------------------------------------'); |
411 | 430 |
412 out.push(PrintSourceEntriesAsText(eventList, | 431 out.push(PrintSourceEntriesAsText(eventList)); |
413 this.securityStrippingCheckbox_.checked)); | |
414 } | 432 } |
415 }; | 433 }; |
416 | 434 |
417 DataView.prototype.appendSocketPoolsAsText_ = function(text, socketPoolInfo) { | 435 DataView.prototype.appendSocketPoolsAsText_ = function(text, socketPoolInfo) { |
418 var socketPools = SocketPoolWrapper.createArrayFrom(socketPoolInfo); | 436 var socketPools = SocketPoolWrapper.createArrayFrom(socketPoolInfo); |
419 var tablePrinter = SocketPoolWrapper.createTablePrinter(socketPools); | 437 var tablePrinter = SocketPoolWrapper.createTablePrinter(socketPools); |
420 text.push(tablePrinter.toText(2)); | 438 text.push(tablePrinter.toText(2)); |
421 | 439 |
422 text.push(''); | 440 text.push(''); |
423 | 441 |
(...skipping 26 matching lines...) Expand all Loading... |
450 * Select all text from log dump. | 468 * Select all text from log dump. |
451 */ | 469 */ |
452 DataView.prototype.selectText_ = function() { | 470 DataView.prototype.selectText_ = function() { |
453 var selection = window.getSelection(); | 471 var selection = window.getSelection(); |
454 selection.removeAllRanges(); | 472 selection.removeAllRanges(); |
455 | 473 |
456 var range = document.createRange(); | 474 var range = document.createRange(); |
457 range.selectNodeContents(this.textPre_); | 475 range.selectNodeContents(this.textPre_); |
458 selection.addRange(range); | 476 selection.addRange(range); |
459 }; | 477 }; |
OLD | NEW |