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

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

Issue 2623743002: DevTools: extract modules (non-extensions) (Closed)
Patch Set: rebaseline Created 3 years, 11 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 14 matching lines...) Expand all
25 */ 25 */
26 constructor(request) { 26 constructor(request) {
27 super(); 27 super();
28 this.registerRequiredCSS('network/webSocketFrameView.css'); 28 this.registerRequiredCSS('network/webSocketFrameView.css');
29 this.element.classList.add('websocket-frame-view'); 29 this.element.classList.add('websocket-frame-view');
30 this._request = request; 30 this._request = request;
31 31
32 this._splitWidget = new UI.SplitWidget(false, true, 'resourceWebSocketFrameS plitViewState'); 32 this._splitWidget = new UI.SplitWidget(false, true, 'resourceWebSocketFrameS plitViewState');
33 this._splitWidget.show(this.element); 33 this._splitWidget.show(this.element);
34 34
35 var columns = /** @type {!Array<!UI.DataGrid.ColumnDescriptor>} */ ([ 35 var columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ ([
36 {id: 'data', title: Common.UIString('Data'), sortable: false, weight: 88}, 36 {id: 'data', title: Common.UIString('Data'), sortable: false, weight: 88}, {
37 {id: 'length', title: Common.UIString('Length'), sortable: false, align: U I.DataGrid.Align.Right, weight: 5}, 37 id: 'length',
38 title: Common.UIString('Length'),
39 sortable: false,
40 align: DataGrid.DataGrid.Align.Right,
41 weight: 5
42 },
38 {id: 'time', title: Common.UIString('Time'), sortable: true, weight: 7} 43 {id: 'time', title: Common.UIString('Time'), sortable: true, weight: 7}
39 ]); 44 ]);
40 45
41 this._dataGrid = new UI.SortableDataGrid(columns); 46 this._dataGrid = new DataGrid.SortableDataGrid(columns);
42 this._dataGrid.setRowContextMenuCallback(onRowContextMenu); 47 this._dataGrid.setRowContextMenuCallback(onRowContextMenu);
43 this._dataGrid.setStickToBottom(true); 48 this._dataGrid.setStickToBottom(true);
44 this._dataGrid.setCellClass('websocket-frame-view-td'); 49 this._dataGrid.setCellClass('websocket-frame-view-td');
45 this._timeComparator = 50 this._timeComparator =
46 /** @type {function(!Network.ResourceWebSocketFrameNode, !Network.Resour ceWebSocketFrameNode):number} */ ( 51 /** @type {function(!Network.ResourceWebSocketFrameNode, !Network.Resour ceWebSocketFrameNode):number} */ (
47 Network.ResourceWebSocketFrameNodeTimeComparator); 52 Network.ResourceWebSocketFrameNodeTimeComparator);
48 this._dataGrid.sortNodes(this._timeComparator, false); 53 this._dataGrid.sortNodes(this._timeComparator, false);
49 this._dataGrid.markColumnAsSortedBy('time', UI.DataGrid.Order.Ascending); 54 this._dataGrid.markColumnAsSortedBy('time', DataGrid.DataGrid.Order.Ascendin g);
50 this._dataGrid.addEventListener(UI.DataGrid.Events.SortingChanged, this._sor tItems, this); 55 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, thi s._sortItems, this);
51 56
52 this._dataGrid.setName('ResourceWebSocketFrameView'); 57 this._dataGrid.setName('ResourceWebSocketFrameView');
53 this._dataGrid.addEventListener(UI.DataGrid.Events.SelectedNode, this._onFra meSelected, this); 58 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, this. _onFrameSelected, this);
54 this._dataGrid.addEventListener(UI.DataGrid.Events.DeselectedNode, this._onF rameDeselected, this); 59 this._dataGrid.addEventListener(DataGrid.DataGrid.Events.DeselectedNode, thi s._onFrameDeselected, this);
55 this._splitWidget.setMainWidget(this._dataGrid.asWidget()); 60 this._splitWidget.setMainWidget(this._dataGrid.asWidget());
56 61
57 var view = new UI.EmptyWidget('Select frame to browse its content.'); 62 var view = new UI.EmptyWidget('Select frame to browse its content.');
58 this._splitWidget.setSidebarWidget(view); 63 this._splitWidget.setSidebarWidget(view);
59 64
60 /** @type {?Network.ResourceWebSocketFrameNode} */ 65 /** @type {?Network.ResourceWebSocketFrameNode} */
61 this._selectedNode = null; 66 this._selectedNode = null;
62 67
63 /** 68 /**
64 * @param {!UI.ContextMenu} contextMenu 69 * @param {!UI.ContextMenu} contextMenu
65 * @param {!UI.DataGridNode} node 70 * @param {!DataGrid.DataGridNode} node
66 */ 71 */
67 function onRowContextMenu(contextMenu, node) { 72 function onRowContextMenu(contextMenu, node) {
68 contextMenu.appendItem( 73 contextMenu.appendItem(
69 Common.UIString.capitalize('Copy ^message'), 74 Common.UIString.capitalize('Copy ^message'),
70 InspectorFrontendHost.copyText.bind(InspectorFrontendHost, node.data.d ata)); 75 InspectorFrontendHost.copyText.bind(InspectorFrontendHost, node.data.d ata));
71 } 76 }
72 } 77 }
73 78
74 /** 79 /**
75 * @param {number} opCode 80 * @param {number} opCode
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 map[opCodes.ContinuationFrame] = 'Connection Close Frame'; 182 map[opCodes.ContinuationFrame] = 'Connection Close Frame';
178 map[opCodes.PingFrame] = 'Ping Frame'; 183 map[opCodes.PingFrame] = 'Ping Frame';
179 map[opCodes.PongFrame] = 'Pong Frame'; 184 map[opCodes.PongFrame] = 'Pong Frame';
180 return map; 185 return map;
181 })(); 186 })();
182 187
183 188
184 /** 189 /**
185 * @unrestricted 190 * @unrestricted
186 */ 191 */
187 Network.ResourceWebSocketFrameNode = class extends UI.SortableDataGridNode { 192 Network.ResourceWebSocketFrameNode = class extends DataGrid.SortableDataGridNode {
188 /** 193 /**
189 * @param {string} url 194 * @param {string} url
190 * @param {!SDK.NetworkRequest.WebSocketFrame} frame 195 * @param {!SDK.NetworkRequest.WebSocketFrame} frame
191 */ 196 */
192 constructor(url, frame) { 197 constructor(url, frame) {
193 var dataText = frame.text; 198 var dataText = frame.text;
194 var length = frame.text.length; 199 var length = frame.text.length;
195 var time = new Date(frame.time * 1000); 200 var time = new Date(frame.time * 1000);
196 var timeText = ('0' + time.getHours()).substr(-2) + ':' + ('0' + time.getMin utes()).substr(-2) + ':' + 201 var timeText = ('0' + time.getHours()).substr(-2) + ':' + ('0' + time.getMin utes()).substr(-2) + ':' +
197 ('0' + time.getSeconds()).substr(-2) + '.' + ('00' + time.getMillisecond s()).substr(-3); 202 ('0' + time.getSeconds()).substr(-2) + '.' + ('00' + time.getMillisecond s()).substr(-3);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 }; 246 };
242 247
243 /** 248 /**
244 * @param {!Network.ResourceWebSocketFrameNode} a 249 * @param {!Network.ResourceWebSocketFrameNode} a
245 * @param {!Network.ResourceWebSocketFrameNode} b 250 * @param {!Network.ResourceWebSocketFrameNode} b
246 * @return {number} 251 * @return {number}
247 */ 252 */
248 Network.ResourceWebSocketFrameNodeTimeComparator = function(a, b) { 253 Network.ResourceWebSocketFrameNodeTimeComparator = function(a, b) {
249 return a._frame.time - b._frame.time; 254 return a._frame.time - b._frame.time;
250 }; 255 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698