OLD | NEW |
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 10 matching lines...) Expand all Loading... |
21 * @extends {WebInspector.VBox} | 21 * @extends {WebInspector.VBox} |
22 * @param {!WebInspector.NetworkRequest} request | 22 * @param {!WebInspector.NetworkRequest} request |
23 */ | 23 */ |
24 WebInspector.ResourceWebSocketFrameView = function(request) | 24 WebInspector.ResourceWebSocketFrameView = function(request) |
25 { | 25 { |
26 WebInspector.VBox.call(this); | 26 WebInspector.VBox.call(this); |
27 this.registerRequiredCSS("network/webSocketFrameView.css"); | 27 this.registerRequiredCSS("network/webSocketFrameView.css"); |
28 this.element.classList.add("websocket-frame-view"); | 28 this.element.classList.add("websocket-frame-view"); |
29 this._request = request; | 29 this._request = request; |
30 | 30 |
31 this._splitView = new WebInspector.SplitView(false, true, "resourceWebSocket
FrameSplitViewState"); | 31 this._splitWidget = new WebInspector.SplitWidget(false, true, "resourceWebSo
cketFrameSplitViewState"); |
32 this._splitView.show(this.element); | 32 this._splitWidget.show(this.element); |
33 | 33 |
34 var columns = [ | 34 var columns = [ |
35 {id: "data", title: WebInspector.UIString("Data"), sortable: false, weig
ht: 88}, | 35 {id: "data", title: WebInspector.UIString("Data"), sortable: false, weig
ht: 88}, |
36 {id: "length", title: WebInspector.UIString("Length"), sortable: false,
align: WebInspector.DataGrid.Align.Right, weight: 5}, | 36 {id: "length", title: WebInspector.UIString("Length"), sortable: false,
align: WebInspector.DataGrid.Align.Right, weight: 5}, |
37 {id: "time", title: WebInspector.UIString("Time"), sortable: true, weigh
t: 7} | 37 {id: "time", title: WebInspector.UIString("Time"), sortable: true, weigh
t: 7} |
38 ]; | 38 ]; |
39 | 39 |
40 this._dataGrid = new WebInspector.SortableDataGrid(columns, undefined, undef
ined, undefined, this._onContextMenu.bind(this)); | 40 this._dataGrid = new WebInspector.SortableDataGrid(columns, undefined, undef
ined, undefined, this._onContextMenu.bind(this)); |
41 this._dataGrid.setStickToBottom(true); | 41 this._dataGrid.setStickToBottom(true); |
42 this._dataGrid.setCellClass("websocket-frame-view-td"); | 42 this._dataGrid.setCellClass("websocket-frame-view-td"); |
43 this._timeComparator = /** @type {!WebInspector.SortableDataGrid.NodeCompara
tor} */ (WebInspector.ResourceWebSocketFrameNodeTimeComparator); | 43 this._timeComparator = /** @type {!WebInspector.SortableDataGrid.NodeCompara
tor} */ (WebInspector.ResourceWebSocketFrameNodeTimeComparator); |
44 this._dataGrid.sortNodes(this._timeComparator, false); | 44 this._dataGrid.sortNodes(this._timeComparator, false); |
45 this._dataGrid.markColumnAsSortedBy("time", WebInspector.DataGrid.Order.Asce
nding); | 45 this._dataGrid.markColumnAsSortedBy("time", WebInspector.DataGrid.Order.Asce
nding); |
46 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged,
this._sortItems, this); | 46 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged,
this._sortItems, this); |
47 | 47 |
48 this._dataGrid.setName("ResourceWebSocketFrameView"); | 48 this._dataGrid.setName("ResourceWebSocketFrameView"); |
49 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, t
his._onFrameSelected, this); | 49 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, t
his._onFrameSelected, this); |
50 this._splitView.setMainView(this._dataGrid); | 50 this._splitWidget.setMainWidget(this._dataGrid); |
51 | 51 |
52 this._messageView = new WebInspector.EmptyView("Select frame to browse its c
ontent."); | 52 this._messageView = new WebInspector.EmptyWidget("Select frame to browse its
content."); |
53 this._splitView.setSidebarView(this._messageView); | 53 this._splitWidget.setSidebarWidget(this._messageView); |
54 } | 54 } |
55 | 55 |
56 /** @enum {number} */ | 56 /** @enum {number} */ |
57 WebInspector.ResourceWebSocketFrameView.OpCodes = { | 57 WebInspector.ResourceWebSocketFrameView.OpCodes = { |
58 ContinuationFrame: 0, | 58 ContinuationFrame: 0, |
59 TextFrame: 1, | 59 TextFrame: 1, |
60 BinaryFrame: 2, | 60 BinaryFrame: 2, |
61 ConnectionCloseFrame: 8, | 61 ConnectionCloseFrame: 8, |
62 PingFrame: 9, | 62 PingFrame: 9, |
63 PongFrame: 10 | 63 PongFrame: 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 * @param {!WebInspector.Event} event | 114 * @param {!WebInspector.Event} event |
115 */ | 115 */ |
116 _onFrameSelected: function(event) | 116 _onFrameSelected: function(event) |
117 { | 117 { |
118 var selectedNode = /** @type {!WebInspector.ResourceWebSocketFrameNode}
*/ (event.target.selectedNode); | 118 var selectedNode = /** @type {!WebInspector.ResourceWebSocketFrameNode}
*/ (event.target.selectedNode); |
119 if (this._messageView) | 119 if (this._messageView) |
120 this._messageView.detach(); | 120 this._messageView.detach(); |
121 if (this._dataView) | 121 if (this._dataView) |
122 this._dataView.detach(); | 122 this._dataView.detach(); |
123 this._dataView = new WebInspector.ResourceSourceFrame(selectedNode.conte
ntProvider()); | 123 this._dataView = new WebInspector.ResourceSourceFrame(selectedNode.conte
ntProvider()); |
124 this._splitView.setSidebarView(this._dataView); | 124 this._splitWidget.setSidebarWidget(this._dataView); |
125 }, | 125 }, |
126 | 126 |
127 refresh: function() | 127 refresh: function() |
128 { | 128 { |
129 this._dataGrid.rootNode().removeChildren(); | 129 this._dataGrid.rootNode().removeChildren(); |
130 var frames = this._request.frames(); | 130 var frames = this._request.frames(); |
131 for (var i = 0; i < frames.length; ++i) | 131 for (var i = 0; i < frames.length; ++i) |
132 this._dataGrid.insertChild(new WebInspector.ResourceWebSocketFrameNo
de(frames[i])); | 132 this._dataGrid.insertChild(new WebInspector.ResourceWebSocketFrameNo
de(frames[i])); |
133 }, | 133 }, |
134 | 134 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 215 |
216 /** | 216 /** |
217 * @param {!WebInspector.ResourceWebSocketFrameNode} a | 217 * @param {!WebInspector.ResourceWebSocketFrameNode} a |
218 * @param {!WebInspector.ResourceWebSocketFrameNode} b | 218 * @param {!WebInspector.ResourceWebSocketFrameNode} b |
219 * @return {number} | 219 * @return {number} |
220 */ | 220 */ |
221 WebInspector.ResourceWebSocketFrameNodeTimeComparator = function(a, b) | 221 WebInspector.ResourceWebSocketFrameNodeTimeComparator = function(a, b) |
222 { | 222 { |
223 return a._frame.time - b._frame.time; | 223 return a._frame.time - b._frame.time; |
224 } | 224 } |
OLD | NEW |