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

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

Issue 2447933002: [Devtools] Restructured contextMenu for DataGrid. (Closed)
Patch Set: changes Created 4 years, 1 month 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 19 matching lines...) Expand all
30 30
31 this._splitWidget = new WebInspector.SplitWidget(false, true, "resourceWebSo cketFrameSplitViewState"); 31 this._splitWidget = new WebInspector.SplitWidget(false, true, "resourceWebSo cketFrameSplitViewState");
32 this._splitWidget.show(this.element); 32 this._splitWidget.show(this.element);
33 33
34 var columns = /** @type {!Array<!WebInspector.DataGrid.ColumnDescriptor>} */ ([ 34 var columns = /** @type {!Array<!WebInspector.DataGrid.ColumnDescriptor>} */ ([
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);
41 this._dataGrid.setRowContextMenuCallback(onRowContextMenu);
41 this._dataGrid.setStickToBottom(true); 42 this._dataGrid.setStickToBottom(true);
42 this._dataGrid.setCellClass("websocket-frame-view-td"); 43 this._dataGrid.setCellClass("websocket-frame-view-td");
43 this._timeComparator = /** @type {!WebInspector.SortableDataGrid.NodeCompara tor} */ (WebInspector.ResourceWebSocketFrameNodeTimeComparator); 44 this._timeComparator = /** @type {!WebInspector.SortableDataGrid.NodeCompara tor} */ (WebInspector.ResourceWebSocketFrameNodeTimeComparator);
44 this._dataGrid.sortNodes(this._timeComparator, false); 45 this._dataGrid.sortNodes(this._timeComparator, false);
45 this._dataGrid.markColumnAsSortedBy("time", WebInspector.DataGrid.Order.Asce nding); 46 this._dataGrid.markColumnAsSortedBy("time", WebInspector.DataGrid.Order.Asce nding);
46 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortItems, this); 47 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortItems, this);
47 48
48 this._dataGrid.setName("ResourceWebSocketFrameView"); 49 this._dataGrid.setName("ResourceWebSocketFrameView");
49 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, t his._onFrameSelected, this); 50 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, t his._onFrameSelected, this);
50 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.DeselectedNode, this._onFrameDeselected, this); 51 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.DeselectedNode, this._onFrameDeselected, this);
51 this._splitWidget.setMainWidget(this._dataGrid.asWidget()); 52 this._splitWidget.setMainWidget(this._dataGrid.asWidget());
52 53
53 var view = new WebInspector.EmptyWidget("Select frame to browse its content. "); 54 var view = new WebInspector.EmptyWidget("Select frame to browse its content. ");
54 this._splitWidget.setSidebarWidget(view); 55 this._splitWidget.setSidebarWidget(view);
55 56
56 /** @type {?WebInspector.ResourceWebSocketFrameNode} */ 57 /** @type {?WebInspector.ResourceWebSocketFrameNode} */
57 this._selectedNode = null; 58 this._selectedNode = null;
59
60 /**
61 * @param {!WebInspector.ContextMenu} contextMenu
62 * @param {!WebInspector.DataGridNode} node
63 */
64 function onRowContextMenu(contextMenu, node)
65 {
66 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^message") , InspectorFrontendHost.copyText.bind(InspectorFrontendHost, node.data.data))
67 }
58 }; 68 };
59 69
60 /** @enum {number} */ 70 /** @enum {number} */
61 WebInspector.ResourceWebSocketFrameView.OpCodes = { 71 WebInspector.ResourceWebSocketFrameView.OpCodes = {
62 ContinuationFrame: 0, 72 ContinuationFrame: 0,
63 TextFrame: 1, 73 TextFrame: 1,
64 BinaryFrame: 2, 74 BinaryFrame: 2,
65 ConnectionCloseFrame: 8, 75 ConnectionCloseFrame: 8,
66 PingFrame: 9, 76 PingFrame: 9,
67 PongFrame: 10 77 PongFrame: 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 }, 168 },
159 169
160 refresh: function() 170 refresh: function()
161 { 171 {
162 this._dataGrid.rootNode().removeChildren(); 172 this._dataGrid.rootNode().removeChildren();
163 var frames = this._request.frames(); 173 var frames = this._request.frames();
164 for (var i = 0; i < frames.length; ++i) 174 for (var i = 0; i < frames.length; ++i)
165 this._dataGrid.insertChild(new WebInspector.ResourceWebSocketFrameNo de(this._request.url, frames[i])); 175 this._dataGrid.insertChild(new WebInspector.ResourceWebSocketFrameNo de(this._request.url, frames[i]));
166 }, 176 },
167 177
168 /**
169 * @param {!WebInspector.ContextMenu} contextMenu
170 * @param {!WebInspector.DataGridNode} node
171 */
172 _onContextMenu: function(contextMenu, node)
173 {
174 contextMenu.appendItem(WebInspector.UIString.capitalize("Copy ^message") , this._copyMessage.bind(this, node.data));
175 },
176
177 /**
178 * @param {!Object} row
179 */
180 _copyMessage: function(row)
181 {
182 InspectorFrontendHost.copyText(row.data);
183 },
184
185 _sortItems: function() 178 _sortItems: function()
186 { 179 {
187 this._dataGrid.sortNodes(this._timeComparator, !this._dataGrid.isSortOrd erAscending()); 180 this._dataGrid.sortNodes(this._timeComparator, !this._dataGrid.isSortOrd erAscending());
188 }, 181 },
189 182
190 __proto__: WebInspector.VBox.prototype 183 __proto__: WebInspector.VBox.prototype
191 }; 184 };
192 185
193 /** 186 /**
194 * @constructor 187 * @constructor
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 243
251 /** 244 /**
252 * @param {!WebInspector.ResourceWebSocketFrameNode} a 245 * @param {!WebInspector.ResourceWebSocketFrameNode} a
253 * @param {!WebInspector.ResourceWebSocketFrameNode} b 246 * @param {!WebInspector.ResourceWebSocketFrameNode} b
254 * @return {number} 247 * @return {number}
255 */ 248 */
256 WebInspector.ResourceWebSocketFrameNodeTimeComparator = function(a, b) 249 WebInspector.ResourceWebSocketFrameNodeTimeComparator = function(a, b)
257 { 250 {
258 return a._frame.time - b._frame.time; 251 return a._frame.time - b._frame.time;
259 }; 252 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698