Chromium Code Reviews| Index: chrome/browser/resources/net_internals/spdyview.js |
| =================================================================== |
| --- chrome/browser/resources/net_internals/spdyview.js (revision 74177) |
| +++ chrome/browser/resources/net_internals/spdyview.js (working copy) |
| @@ -8,11 +8,27 @@ |
| * |
| * @constructor |
| */ |
| -function SpdyView(mainBoxId, spdySessionNoneSpanId, spdySessionLinkSpanId, |
| +function SpdyView(mainBoxId, spdyEnabledSpanId, |
| + spdyUseAlternateProtocolSpanId, |
| + spdyForceAlwaysSpanId, spdyForceOverSslSpanId, |
| + spdyNextProtocolsSpanId, spdyAlternateProtocolMappingsDivId, |
| + spdySessionNoneSpanId, spdySessionLinkSpanId, |
| spdySessionDivId) { |
| DivView.call(this, mainBoxId); |
| g_browser.addSpdySessionInfoObserver(this); |
| + g_browser.addSpdyStatusObserver(this); |
| + g_browser.addSpdyAlternateProtocolMappingsObserver(this); |
| + this.spdyEnabledSpan_ = document.getElementById(spdyEnabledSpanId); |
| + this.spdyUseAlternateProtocolSpan_ = |
| + document.getElementById(spdyUseAlternateProtocolSpanId); |
| + this.spdyForceAlwaysSpan_ = document.getElementById(spdyForceAlwaysSpanId); |
| + this.spdyForceOverSslSpan_ = document.getElementById(spdyForceOverSslSpanId); |
| + this.spdyNextProtocolsSpan_ = |
| + document.getElementById(spdyNextProtocolsSpanId); |
| + |
| + this.spdyAlternateProtocolMappingsDiv_ = |
| + document.getElementById(spdyAlternateProtocolMappingsDivId); |
| this.spdySessionNoneSpan_ = document.getElementById(spdySessionNoneSpanId); |
| this.spdySessionLinkSpan_ = document.getElementById(spdySessionLinkSpanId); |
| this.spdySessionDiv_ = document.getElementById(spdySessionDivId); |
| @@ -36,9 +52,42 @@ |
| var tablePrinter = SpdyView.createSessionTablePrinter(spdySessionInfo); |
| tablePrinter.toHTML(this.spdySessionDiv_, 'styledTable'); |
| + |
| }; |
| /** |
| + * Displays information on the global SPDY status. |
| + */ |
| +SpdyView.prototype.onSpdyStatusChanged = function(spdyStatus) { |
| + this.spdyEnabledSpan_.innerHTML = spdyStatus.spdy_enabled; |
|
eroman
2011/02/09 04:51:13
please don't use innerHTML for setting text which
Ryan Hamilton
2011/02/09 17:42:32
Oh cute! I didn't think about that. Gotta love w
|
| + this.spdyUseAlternateProtocolSpan_.innerHTML = |
| + spdyStatus.use_alternate_protocols; |
| + this.spdyForceAlwaysSpan_.innerHTML = spdyStatus.force_spdy_always; |
| + this.spdyForceOverSslSpan_.innerHTML = spdyStatus.force_spdy_over_ssl; |
| + this.spdyNextProtocolsSpan_.innerHTML = spdyStatus.next_protos; |
| +} |
| + |
| +/** |
| + * If |spdyAlternateProtocolMappings| is not empty, displays a single table |
| + * with information on each alternate protocol enabled server. Otherwise, |
| + * displays "None". |
| + */ |
| +SpdyView.prototype.onSpdyAlternateProtocolMappingsChanged = |
| + function(spdyAlternateProtocolMappings) { |
| + |
| + this.spdyAlternateProtocolMappingsDiv_.innerHTML = ''; |
| + |
| + if (spdyAlternateProtocolMappings != null && |
|
eroman
2011/02/09 04:51:13
nit: would it be sufficient to do
if (spdyAlterna
Ryan Hamilton
2011/02/09 17:42:32
That would be great, but I tried it and it appears
|
| + spdyAlternateProtocolMappings.length > 0) { |
| + var tabPrinter = SpdyView.createAlternateProtocolMappingsTablePrinter( |
| + spdyAlternateProtocolMappings); |
| + tabPrinter.toHTML(this.spdyAlternateProtocolMappingsDiv_, 'styledTable'); |
| + } else { |
| + this.spdyAlternateProtocolMappingsDiv_.innerHTML = 'None'; |
| + } |
| +}; |
| + |
| +/** |
| * Creates a table printer to print out the state of list of SPDY sessions. |
| */ |
| SpdyView.createSessionTablePrinter = function(spdySessions) { |
| @@ -85,3 +134,24 @@ |
| return tablePrinter; |
| }; |
| + |
| +/** |
| + * Creates a table printer to print out the list of alternate protocol |
| + * mappings. |
| + */ |
| +SpdyView.createAlternateProtocolMappingsTablePrinter = |
| + function(spdyAlternateProtocolMappings) { |
| + var tablePrinter = new TablePrinter(); |
| + tablePrinter.addHeaderCell('Host'); |
| + tablePrinter.addHeaderCell('Alternate Protocol'); |
| + |
| + for (var i = 0; i < spdyAlternateProtocolMappings.length; i++) { |
| + var entry = spdyAlternateProtocolMappings[i]; |
| + tablePrinter.addRow(); |
| + |
| + tablePrinter.addCell(entry.host_port_pair); |
| + tablePrinter.addCell(entry.alternate_protocol); |
| + } |
| + return tablePrinter; |
| +}; |
| + |