summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/net_export/net_export.js
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/resources/net_export/net_export.js')
-rw-r--r--chrome/browser/resources/net_export/net_export.js71
1 files changed, 40 insertions, 31 deletions
diff --git a/chrome/browser/resources/net_export/net_export.js b/chrome/browser/resources/net_export/net_export.js
index 799a643..c9521b4 100644
--- a/chrome/browser/resources/net_export/net_export.js
+++ b/chrome/browser/resources/net_export/net_export.js
@@ -24,23 +24,14 @@ var NetExportView = (function() {
/** @const */ var POLL_INTERVAL_MS = 5000;
// --------------------------------------------------------------------------
- // Important IDs in the HTML document
- // --------------------------------------------------------------------------
-
- /** @const */ var START_DATA_BUTTON_ID = 'export-view-start-data';
- /** @const */ var STOP_DATA_BUTTON_ID = 'export-view-stop-data';
- /** @const */ var SEND_DATA_BUTTON_ID = 'export-view-send-data';
- /** @const */ var FILE_PATH_TEXT_ID = 'export-view-file-path-text';
-
- // --------------------------------------------------------------------------
/**
* @constructor
*/
function NetExportView() {
- $(START_DATA_BUTTON_ID).onclick = this.onStartData_.bind(this);
- $(STOP_DATA_BUTTON_ID).onclick = this.onStopData_.bind(this);
- $(SEND_DATA_BUTTON_ID).onclick = this.onSendData_.bind(this);
+ $('export-view-start-data').onclick = this.onStartData_.bind(this);
+ $('export-view-stop-data').onclick = this.onStopData_.bind(this);
+ $('export-view-send-data').onclick = this.onSendData_.bind(this);
window.setInterval(function() { chrome.send('getExportNetLogInfo'); },
POLL_INTERVAL_MS);
@@ -55,7 +46,8 @@ var NetExportView = (function() {
* Starts saving NetLog data to a file.
*/
onStartData_: function() {
- chrome.send('startNetLog');
+ var stripPrivateData = $('export-view-private-data-toggle').checked;
+ chrome.send('startNetLog', [stripPrivateData]);
},
/**
@@ -73,34 +65,51 @@ var NetExportView = (function() {
},
/**
- * Enable or disable START_DATA_BUTTON_ID, STOP_DATA_BUTTON_ID and
- * SEND_DATA_BUTTON_ID buttons. Displays the path name of the file where
- * NetLog data is collected.
+ * Updates the UI to reflect the current state. Displays the path name of
+ * the file where NetLog data is collected.
*/
onExportNetLogInfoChanged: function(exportNetLogInfo) {
if (exportNetLogInfo.file) {
var message = '';
- if (exportNetLogInfo.state == 'ALLOW_STOP')
+ if (exportNetLogInfo.state == 'LOGGING')
message = 'NetLog data is collected in: ';
- else if (exportNetLogInfo.state == 'ALLOW_START_SEND')
+ else if (exportNetLogInfo.logType != 'NONE')
message = 'NetLog data to send is in: ';
- $(FILE_PATH_TEXT_ID).textContent = message + exportNetLogInfo.file;
+ $('export-view-file-path-text').textContent =
+ message + exportNetLogInfo.file;
} else {
- $(FILE_PATH_TEXT_ID).textContent = '';
+ $('export-view-file-path-text').textContent = '';
}
- $(START_DATA_BUTTON_ID).disabled = true;
- $(STOP_DATA_BUTTON_ID).disabled = true;
- $(SEND_DATA_BUTTON_ID).disabled = true;
- if (exportNetLogInfo.state == 'ALLOW_START') {
- $(START_DATA_BUTTON_ID).disabled = false;
- } else if (exportNetLogInfo.state == 'ALLOW_STOP') {
- $(STOP_DATA_BUTTON_ID).disabled = false;
- } else if (exportNetLogInfo.state == 'ALLOW_START_SEND') {
- $(START_DATA_BUTTON_ID).disabled = false;
- $(SEND_DATA_BUTTON_ID).disabled = false;
+ $('export-view-private-data-toggle').disabled = true;
+ $('export-view-start-data').disabled = true;
+ $('export-view-deletes-log-text').hidden = true;
+ $('export-view-stop-data').disabled = true;
+ $('export-view-send-data').disabled = true;
+ $('export-view-private-data-text').hidden = true;
+ $('export-view-send-old-log-text').hidden = true;
+ if (exportNetLogInfo.state == 'NOT_LOGGING') {
+ // Allow making a new log.
+ $('export-view-private-data-toggle').disabled = false;
+ $('export-view-start-data').disabled = false;
+
+ // If there's an existing log, allow sending it.
+ if (exportNetLogInfo.logType != 'NONE') {
+ $('export-view-deletes-log-text').hidden = false;
+ $('export-view-send-data').disabled = false;
+ if (exportNetLogInfo.logType == 'UNKNOWN') {
+ $('export-view-send-old-log-text').hidden = false;
+ } else if (exportNetLogInfo.logType == 'NORMAL') {
+ $('export-view-private-data-text').hidden = false;
+ }
+ }
+ } else if (exportNetLogInfo.state == 'LOGGING') {
+ // Only possible to stop logging. Checkbox reflects current state.
+ $('export-view-private-data-toggle').checked =
+ (exportNetLogInfo.logType == 'STRIP_PRIVATE_DATA');
+ $('export-view-stop-data').disabled = false;
} else if (exportNetLogInfo.state == 'UNINITIALIZED') {
- $(FILE_PATH_TEXT_ID).textContent =
+ $('export-view-file-path-text').textContent =
'Unable to initialize NetLog data file.';
}
}