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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/ResourceWebSocketFrameView.js

Issue 1957053002: DevTools: simplify NetworkProject.addFileForURL method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Research In Motion Limited. All rights reserved. 2 * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public 5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 { 104 {
105 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Web socketFrameAdded, this._frameAdded, this); 105 this._request.removeEventListener(WebInspector.NetworkRequest.Events.Web socketFrameAdded, this._frameAdded, this);
106 }, 106 },
107 107
108 /** 108 /**
109 * @param {!WebInspector.Event} event 109 * @param {!WebInspector.Event} event
110 */ 110 */
111 _frameAdded: function(event) 111 _frameAdded: function(event)
112 { 112 {
113 var frame = /** @type {!WebInspector.NetworkRequest.WebSocketFrame} */ ( event.data); 113 var frame = /** @type {!WebInspector.NetworkRequest.WebSocketFrame} */ ( event.data);
114 this._dataGrid.insertChild(new WebInspector.ResourceWebSocketFrameNode(f rame)); 114 this._dataGrid.insertChild(new WebInspector.ResourceWebSocketFrameNode(t his._request.url, frame));
115 }, 115 },
116 116
117 /** 117 /**
118 * @param {!WebInspector.Event} event 118 * @param {!WebInspector.Event} event
119 */ 119 */
120 _onFrameSelected: function(event) 120 _onFrameSelected: function(event)
121 { 121 {
122 var selectedNode = /** @type {!WebInspector.ResourceWebSocketFrameNode} */ (event.target.selectedNode); 122 var selectedNode = /** @type {!WebInspector.ResourceWebSocketFrameNode} */ (event.target.selectedNode);
123 this._currentSelectedNode = selectedNode; 123 this._currentSelectedNode = selectedNode;
124 var contentProvider = selectedNode.contentProvider(); 124 var contentProvider = selectedNode.contentProvider();
(...skipping 30 matching lines...) Expand all
155 _onFrameDeselected: function(event) 155 _onFrameDeselected: function(event)
156 { 156 {
157 this._currentSelectedNode = null; 157 this._currentSelectedNode = null;
158 }, 158 },
159 159
160 refresh: function() 160 refresh: function()
161 { 161 {
162 this._dataGrid.rootNode().removeChildren(); 162 this._dataGrid.rootNode().removeChildren();
163 var frames = this._request.frames(); 163 var frames = this._request.frames();
164 for (var i = 0; i < frames.length; ++i) 164 for (var i = 0; i < frames.length; ++i)
165 this._dataGrid.insertChild(new WebInspector.ResourceWebSocketFrameNo de(frames[i])); 165 this._dataGrid.insertChild(new WebInspector.ResourceWebSocketFrameNo de(this._request.url, frames[i]));
166 }, 166 },
167 167
168 /** 168 /**
169 * @param {!WebInspector.ContextMenu} contextMenu 169 * @param {!WebInspector.ContextMenu} contextMenu
170 * @param {!WebInspector.DataGridNode} node 170 * @param {!WebInspector.DataGridNode} node
171 */ 171 */
172 _onContextMenu: function(contextMenu, node) 172 _onContextMenu: function(contextMenu, node)
173 { 173 {
174 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^message") , this._copyMessage.bind(this, node.data)); 174 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^message") , this._copyMessage.bind(this, node.data));
175 }, 175 },
(...skipping 10 matching lines...) Expand all
186 { 186 {
187 this._dataGrid.sortNodes(this._timeComparator, !this._dataGrid.isSortOrd erAscending()); 187 this._dataGrid.sortNodes(this._timeComparator, !this._dataGrid.isSortOrd erAscending());
188 }, 188 },
189 189
190 __proto__: WebInspector.VBox.prototype 190 __proto__: WebInspector.VBox.prototype
191 } 191 }
192 192
193 /** 193 /**
194 * @constructor 194 * @constructor
195 * @extends {WebInspector.SortableDataGridNode} 195 * @extends {WebInspector.SortableDataGridNode}
196 * @param {string} url
196 * @param {!WebInspector.NetworkRequest.WebSocketFrame} frame 197 * @param {!WebInspector.NetworkRequest.WebSocketFrame} frame
197 */ 198 */
198 WebInspector.ResourceWebSocketFrameNode = function(frame) 199 WebInspector.ResourceWebSocketFrameNode = function(url, frame)
199 { 200 {
200 this._frame = frame; 201 this._frame = frame;
201 this._dataText = frame.text; 202 this._dataText = frame.text;
203 this._url = url;
202 var length = frame.text.length; 204 var length = frame.text.length;
203 var time = new Date(frame.time * 1000); 205 var time = new Date(frame.time * 1000);
204 var timeText = ("0" + time.getHours()).substr(-2) + ":" + ("0" + time.getMin utes()).substr(-2) + ":" + ("0" + time.getSeconds()).substr(-2) + "." + ("00" + time.getMilliseconds()).substr(-3); 206 var timeText = ("0" + time.getHours()).substr(-2) + ":" + ("0" + time.getMin utes()).substr(-2) + ":" + ("0" + time.getSeconds()).substr(-2) + "." + ("00" + time.getMilliseconds()).substr(-3);
205 var timeNode = createElement("div"); 207 var timeNode = createElement("div");
206 timeNode.createTextChild(timeText); 208 timeNode.createTextChild(timeText);
207 timeNode.title = time.toLocaleString(); 209 timeNode.title = time.toLocaleString();
208 210
209 this._isTextFrame = frame.opCode === WebInspector.ResourceWebSocketFrameView .OpCodes.TextFrame; 211 this._isTextFrame = frame.opCode === WebInspector.ResourceWebSocketFrameView .OpCodes.TextFrame;
210 if (!this._isTextFrame) 212 if (!this._isTextFrame)
211 this._dataText = WebInspector.ResourceWebSocketFrameView.opCodeDescripti on(frame.opCode, frame.mask); 213 this._dataText = WebInspector.ResourceWebSocketFrameView.opCodeDescripti on(frame.opCode, frame.mask);
(...skipping 21 matching lines...) Expand all
233 nodeSelfHeight: function() 235 nodeSelfHeight: function()
234 { 236 {
235 return 17; 237 return 17;
236 }, 238 },
237 239
238 /** 240 /**
239 * @return {!WebInspector.ContentProvider} 241 * @return {!WebInspector.ContentProvider}
240 */ 242 */
241 contentProvider: function() 243 contentProvider: function()
242 { 244 {
243 return new WebInspector.StaticContentProvider(WebInspector.resourceTypes .WebSocket, this._dataText); 245 return new WebInspector.StaticContentProvider(WebInspector.resourceTypes .WebSocket, this._dataText, this._url);
244 }, 246 },
245 247
246 __proto__: WebInspector.SortableDataGridNode.prototype 248 __proto__: WebInspector.SortableDataGridNode.prototype
247 } 249 }
248 250
249 /** 251 /**
250 * @param {!WebInspector.ResourceWebSocketFrameNode} a 252 * @param {!WebInspector.ResourceWebSocketFrameNode} a
251 * @param {!WebInspector.ResourceWebSocketFrameNode} b 253 * @param {!WebInspector.ResourceWebSocketFrameNode} b
252 * @return {number} 254 * @return {number}
253 */ 255 */
254 WebInspector.ResourceWebSocketFrameNodeTimeComparator = function(a, b) 256 WebInspector.ResourceWebSocketFrameNodeTimeComparator = function(a, b)
255 { 257 {
256 return a._frame.time - b._frame.time; 258 return a._frame.time - b._frame.time;
257 } 259 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698