Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: chrome/browser/resources/net_internals/dataview.js

Issue 2052003: Display the text dump for chrome://net2#data inline, rather than in a new win... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/net_internals/index.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/net_internals/dataview.js
===================================================================
--- chrome/browser/resources/net_internals/dataview.js (revision 46859)
+++ chrome/browser/resources/net_internals/dataview.js (working copy)
@@ -12,80 +12,23 @@
*
* @constructor
*/
-function DataView(mainBoxId, exportJsonButtonId, exportTextButtonId) {
+function DataView(mainBoxId, outputTextBoxId, exportTextButtonId) {
DivView.call(this, mainBoxId);
- var exportJsonButton = document.getElementById(exportJsonButtonId);
+ this.textPre_ = document.getElementById(outputTextBoxId);
var exportTextButton = document.getElementById(exportTextButtonId);
- exportJsonButton.onclick = this.onExportToJSON_.bind(this);
exportTextButton.onclick = this.onExportToText_.bind(this);
}
inherits(DataView, DivView);
/**
- * Very simple output format which directly displays the internally captured
- * data in its javascript format.
- */
-DataView.prototype.onExportToJSON_ = function() {
- // Format some text describing the data we have captured.
- var text = []; // Lines of text.
-
- text.push('//----------------------------------------------');
- text.push('// Proxy settings');
- text.push('//----------------------------------------------');
- text.push('');
-
- text.push('proxySettings = ' +
- JSON.stringify(g_browser.proxySettings_.currentData_));
-
- text.push('');
- text.push('//----------------------------------------------');
- text.push('// Bad proxies');
- text.push('//----------------------------------------------');
- text.push('');
-
- text.push('badProxies = ' +
- JSON.stringify(g_browser.badProxies_.currentData_));
-
- text.push('');
- text.push('//----------------------------------------------');
- text.push('// Host resolver cache');
- text.push('//----------------------------------------------');
- text.push('');
-
- text.push('hostResolverCache = ' +
- JSON.stringify(g_browser.hostResolverCache_.currentData_));
-
- text.push('');
- text.push('//----------------------------------------------');
- text.push('// Passively captured events');
- text.push('//----------------------------------------------');
- text.push('');
-
- this.appendPrettyPrintedJsonArray_('passive',
- g_browser.getAllPassivelyCapturedEvents(),
- text);
-
- text.push('');
- text.push('//----------------------------------------------');
- text.push('// Actively captured events');
- text.push('//----------------------------------------------');
- text.push('');
-
- this.appendPrettyPrintedJsonArray_('active',
- g_browser.getAllActivelyCapturedEvents(),
- text);
-
- // Open a new window to display this text.
- this.displayPopupWindow_(text.join('\n'));
-};
-
-/**
* Presents the captured data as formatted text.
*/
DataView.prototype.onExportToText_ = function() {
+ this.setText_("Generating...");
+
var text = [];
// Print some basic information about our environment.
@@ -150,7 +93,7 @@
this.appendRequestsPrintedAsText_(text);
// Open a new window to display this text.
- this.displayPopupWindow_(text.join('\n'));
+ this.setText_(text.join('\n'));
};
DataView.prototype.appendRequestsPrintedAsText_ = function(out) {
@@ -202,29 +145,14 @@
};
/**
- * Helper function to open a new window and display |text| in it.
+ * Helper function to set this view's content to |text|.
*/
-DataView.prototype.displayPopupWindow_ = function(text) {
- // Note that we use a data:URL because the chrome:// URL scheme doesn't
- // allow us to mutate any new windows we open.
- dataUrl = 'data:text/plain,' + encodeURIComponent(text);
- window.open(dataUrl, '_blank');
+DataView.prototype.setText_ = function(text) {
+ this.textPre_.innerHTML = '';
+ addTextNode(this.textPre_, text);
};
/**
- * Stringifies |arrayData| as JSON-like output, and appends it to the
- * line buffer |out|.
- */
-DataView.prototype.appendPrettyPrintedJsonArray_ = function(name,
- arrayData,
- out) {
- out.push(name + ' = [];');
- for (var i = 0; i < arrayData.length; ++i) {
- out.push(name + '[' + i + '] = ' + JSON.stringify(arrayData[i]) + ';');
- }
-};
-
-/**
* Stringifies |arrayData| to formatted table output, and appends it to the
* line buffer |out|.
*/
« no previous file with comments | « no previous file | chrome/browser/resources/net_internals/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698