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

Side by Side Diff: chrome/browser/resources/net_internals/spdyview.js

Issue 7531005: Rename the net_internals file names to include hyphens. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Add some missing files Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 /**
6 * This view displays a summary of the state of each SPDY sessions, and
7 * has links to display them in the events tab.
8 *
9 * @constructor
10 */
11 function SpdyView() {
12 const mainBoxId = 'spdyTabContent';
13 const spdyEnabledSpanId = 'spdyEnabledSpan';
14 const spdyUseAlternateProtocolSpanId = 'spdyUseAlternateProtocolSpan';
15 const spdyForceAlwaysSpanId = 'spdyForceAlwaysSpan';
16 const spdyForceOverSslSpanId = 'spdyForceOverSslSpan';
17 const spdyNextProtocolsSpanId = 'spdyNextProtocolsSpan';
18 const spdyAlternateProtocolMappingsDivId = 'spdyAlternateProtocolMappingsDiv';
19 const spdySessionNoneSpanId = 'spdySessionNoneSpan';
20 const spdySessionLinkSpanId = 'spdySessionLinkSpan';
21 const spdySessionDivId = 'spdySessionDiv';
22
23 DivView.call(this, mainBoxId);
24 g_browser.addSpdySessionInfoObserver(this);
25 g_browser.addSpdyStatusObserver(this);
26 g_browser.addSpdyAlternateProtocolMappingsObserver(this);
27
28 this.spdyEnabledSpan_ = $(spdyEnabledSpanId);
29 this.spdyUseAlternateProtocolSpan_ = $(spdyUseAlternateProtocolSpanId);
30 this.spdyForceAlwaysSpan_ = $(spdyForceAlwaysSpanId);
31 this.spdyForceOverSslSpan_ = $(spdyForceOverSslSpanId);
32 this.spdyNextProtocolsSpan_ = $(spdyNextProtocolsSpanId);
33
34 this.spdyAlternateProtocolMappingsDiv_ =
35 $(spdyAlternateProtocolMappingsDivId);
36 this.spdySessionNoneSpan_ = $(spdySessionNoneSpanId);
37 this.spdySessionLinkSpan_ = $(spdySessionLinkSpanId);
38 this.spdySessionDiv_ = $(spdySessionDivId);
39 }
40
41 inherits(SpdyView, DivView);
42
43 SpdyView.prototype.onLoadLogFinish = function(data) {
44 return this.onSpdySessionInfoChanged(data.spdySessionInfo) &&
45 this.onSpdyStatusChanged(data.spdyStatus) &&
46 this.onSpdyAlternateProtocolMappingsChanged(
47 data.spdyAlternateProtocolMappings);
48 };
49
50 /**
51 * If |spdySessionInfo| there are any sessions, display a single table with
52 * information on each SPDY session. Otherwise, displays "None".
53 */
54 SpdyView.prototype.onSpdySessionInfoChanged = function(spdySessionInfo) {
55 this.spdySessionDiv_.innerHTML = '';
56
57 var hasNoSession = (spdySessionInfo == null || spdySessionInfo.length == 0);
58 setNodeDisplay(this.spdySessionNoneSpan_, hasNoSession);
59 setNodeDisplay(this.spdySessionLinkSpan_, !hasNoSession);
60
61 // Only want to be hide the tab if there's no data. In the case of having
62 // data but no sessions, still show the tab.
63 if (!spdySessionInfo)
64 return false;
65
66 if (!hasNoSession) {
67 var tablePrinter = SpdyView.createSessionTablePrinter(spdySessionInfo);
68 tablePrinter.toHTML(this.spdySessionDiv_, 'styledTable');
69 }
70
71 return true;
72 };
73
74 /**
75 * Displays information on the global SPDY status.
76 */
77 SpdyView.prototype.onSpdyStatusChanged = function(spdyStatus) {
78 this.spdyEnabledSpan_.textContent = spdyStatus.spdy_enabled;
79 this.spdyUseAlternateProtocolSpan_.textContent =
80 spdyStatus.use_alternate_protocols;
81 this.spdyForceAlwaysSpan_.textContent = spdyStatus.force_spdy_always;
82 this.spdyForceOverSslSpan_.textContent = spdyStatus.force_spdy_over_ssl;
83 this.spdyNextProtocolsSpan_.textContent = spdyStatus.next_protos;
84
85 return true;
86 };
87
88 /**
89 * If |spdyAlternateProtocolMappings| is not empty, displays a single table
90 * with information on each alternate protocol enabled server. Otherwise,
91 * displays "None".
92 */
93 SpdyView.prototype.onSpdyAlternateProtocolMappingsChanged =
94 function(spdyAlternateProtocolMappings) {
95
96 this.spdyAlternateProtocolMappingsDiv_.innerHTML = '';
97
98 if (spdyAlternateProtocolMappings != null &&
99 spdyAlternateProtocolMappings.length > 0) {
100 var tabPrinter = SpdyView.createAlternateProtocolMappingsTablePrinter(
101 spdyAlternateProtocolMappings);
102 tabPrinter.toHTML(this.spdyAlternateProtocolMappingsDiv_, 'styledTable');
103 } else {
104 this.spdyAlternateProtocolMappingsDiv_.innerHTML = 'None';
105 }
106 return true;
107 };
108
109 /**
110 * Creates a table printer to print out the state of list of SPDY sessions.
111 */
112 SpdyView.createSessionTablePrinter = function(spdySessions) {
113 var tablePrinter = new TablePrinter();
114 tablePrinter.addHeaderCell('Host');
115 tablePrinter.addHeaderCell('Proxy');
116 tablePrinter.addHeaderCell('ID');
117 tablePrinter.addHeaderCell('Active streams');
118 tablePrinter.addHeaderCell('Unclaimed pushed');
119 tablePrinter.addHeaderCell('Max');
120 tablePrinter.addHeaderCell('Initiated');
121 tablePrinter.addHeaderCell('Pushed');
122 tablePrinter.addHeaderCell('Pushed and claimed');
123 tablePrinter.addHeaderCell('Abandoned');
124 tablePrinter.addHeaderCell('Received frames');
125 tablePrinter.addHeaderCell('Secure');
126 tablePrinter.addHeaderCell('Sent settings');
127 tablePrinter.addHeaderCell('Received settings');
128 tablePrinter.addHeaderCell('Error');
129
130 for (var i = 0; i < spdySessions.length; i++) {
131 var session = spdySessions[i];
132 tablePrinter.addRow();
133
134 tablePrinter.addCell(session.host_port_pair);
135 tablePrinter.addCell(session.proxy);
136
137 var idCell = tablePrinter.addCell(session.source_id);
138 idCell.link = '#events&q=id:' + session.source_id;
139
140 tablePrinter.addCell(session.active_streams);
141 tablePrinter.addCell(session.unclaimed_pushed_streams);
142 tablePrinter.addCell(session.max_concurrent_streams);
143 tablePrinter.addCell(session.streams_initiated_count);
144 tablePrinter.addCell(session.streams_pushed_count);
145 tablePrinter.addCell(session.streams_pushed_and_claimed_count);
146 tablePrinter.addCell(session.streams_abandoned_count);
147 tablePrinter.addCell(session.frames_received);
148 tablePrinter.addCell(session.is_secure);
149 tablePrinter.addCell(session.sent_settings);
150 tablePrinter.addCell(session.received_settings);
151 tablePrinter.addCell(session.error);
152 }
153 return tablePrinter;
154 };
155
156
157 /**
158 * Creates a table printer to print out the list of alternate protocol
159 * mappings.
160 */
161 SpdyView.createAlternateProtocolMappingsTablePrinter =
162 function(spdyAlternateProtocolMappings) {
163 var tablePrinter = new TablePrinter();
164 tablePrinter.addHeaderCell('Host');
165 tablePrinter.addHeaderCell('Alternate Protocol');
166
167 for (var i = 0; i < spdyAlternateProtocolMappings.length; i++) {
168 var entry = spdyAlternateProtocolMappings[i];
169 tablePrinter.addRow();
170
171 tablePrinter.addCell(entry.host_port_pair);
172 tablePrinter.addCell(entry.alternate_protocol);
173 }
174 return tablePrinter;
175 };
176
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/spdy_view.js ('k') | chrome/browser/resources/net_internals/tab_switcher_view.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698