OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @param {!WebInspector.NetworkLogView} networkLogView | 7 * @param {!WebInspector.NetworkLogView} networkLogView |
8 * @param {!WebInspector.Setting} networkLogLargeRowsSetting | 8 * @param {!WebInspector.Setting} networkLogLargeRowsSetting |
9 */ | 9 */ |
10 WebInspector.NetworkLogViewColumns = function(networkLogView, networkLogLargeRow
sSetting) | 10 WebInspector.NetworkLogViewColumns = function(networkLogView, networkLogLargeRow
sSetting) |
11 { | 11 { |
12 this._networkLogView = networkLogView; | 12 this._networkLogView = networkLogView; |
13 | 13 |
14 var defaultColumnsVisibility = WebInspector.NetworkLogViewColumns._defaultCo
lumnsVisibility; | 14 var defaultColumnsVisibility = WebInspector.NetworkLogViewColumns._defaultCo
lumnsVisibility; |
15 /** @type {!WebInspector.Setting} */ | 15 /** @type {!WebInspector.Setting} */ |
16 this._columnsVisibilitySetting = WebInspector.settings.createSetting("networ
kLogColumnsVisibility", defaultColumnsVisibility); | 16 this._columnsVisibilitySetting = WebInspector.settings.createSetting("networ
kLogColumnsVisibility", defaultColumnsVisibility); |
17 var savedColumnsVisibility = this._columnsVisibilitySetting.get(); | 17 var savedColumnsVisibility = this._columnsVisibilitySetting.get(); |
18 /** @type {!Object.<boolean>} */ | 18 /** @type {!Object.<boolean>} */ |
19 var columnsVisibility = {}; | 19 var columnsVisibility = {}; |
20 for (var columnId in defaultColumnsVisibility) | 20 for (var columnId in defaultColumnsVisibility) |
21 columnsVisibility[columnId] = savedColumnsVisibility.hasOwnProperty(colu
mnId) ? savedColumnsVisibility[columnId] : defaultColumnsVisibility[columnId]; | 21 columnsVisibility[columnId] = savedColumnsVisibility.hasOwnProperty(colu
mnId) ? savedColumnsVisibility[columnId] : defaultColumnsVisibility[columnId]; |
22 this._columnsVisibilitySetting.set(columnsVisibility); | 22 this._columnsVisibilitySetting.set(columnsVisibility); |
23 | 23 |
24 networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, this); | 24 this._networkLogLargeRowsSetting = networkLogLargeRowsSetting; |
| 25 this._networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, thi
s); |
25 | 26 |
26 /** @type {!Array<{time: number, element: !Element}>} */ | 27 /** @type {!Array<{time: number, element: !Element}>} */ |
27 this._eventDividers = []; | 28 this._eventDividers = []; |
28 | 29 |
29 this._gridMode = true; | 30 this._gridMode = true; |
30 | 31 |
31 /** @type {?WebInspector.DataGrid} */ | 32 /** @type {?WebInspector.DataGrid} */ |
32 this._dataGrid = null; | 33 this._dataGrid = null; |
33 /** @type {!Array.<!WebInspector.ColumnConfig>} */ | 34 /** @type {!Array.<!WebInspector.ColumnConfig>} */ |
34 this._columns = []; | 35 this._columns = []; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 this._timelineGrid.element.classList.add("network-timeline-grid"); | 265 this._timelineGrid.element.classList.add("network-timeline-grid"); |
265 this._dataGrid.element.appendChild(this._timelineGrid.element); | 266 this._dataGrid.element.appendChild(this._timelineGrid.element); |
266 | 267 |
267 this._updateColumns(); | 268 this._updateColumns(); |
268 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan
ged, this._sortItems, this); | 269 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan
ged, this._sortItems, this); |
269 this._dataGrid.sortNodes(this._sortingFunctions.startTime, false); | 270 this._dataGrid.sortNodes(this._sortingFunctions.startTime, false); |
270 this._patchTimelineHeader(); | 271 this._patchTimelineHeader(); |
271 | 272 |
272 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi
zed, this.updateDividersIfNeeded, this); | 273 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi
zed, this.updateDividersIfNeeded, this); |
273 | 274 |
| 275 this._updateRowsSize(); |
| 276 |
274 return this._dataGrid; | 277 return this._dataGrid; |
275 }, | 278 }, |
276 | 279 |
277 _createSortingFunctions: function() | 280 _createSortingFunctions: function() |
278 { | 281 { |
279 this._sortingFunctions.name = WebInspector.NetworkDataGridNode.NameCompa
rator; | 282 this._sortingFunctions.name = WebInspector.NetworkDataGridNode.NameCompa
rator; |
280 this._sortingFunctions.method = WebInspector.NetworkDataGridNode.Request
PropertyComparator.bind(null, "requestMethod"); | 283 this._sortingFunctions.method = WebInspector.NetworkDataGridNode.Request
PropertyComparator.bind(null, "requestMethod"); |
281 this._sortingFunctions.status = WebInspector.NetworkDataGridNode.Request
PropertyComparator.bind(null, "statusCode"); | 284 this._sortingFunctions.status = WebInspector.NetworkDataGridNode.Request
PropertyComparator.bind(null, "statusCode"); |
282 this._sortingFunctions.protocol = WebInspector.NetworkDataGridNode.Reque
stPropertyComparator.bind(null, "protocol"); | 285 this._sortingFunctions.protocol = WebInspector.NetworkDataGridNode.Reque
stPropertyComparator.bind(null, "protocol"); |
283 this._sortingFunctions.scheme = WebInspector.NetworkDataGridNode.Request
PropertyComparator.bind(null, "scheme"); | 286 this._sortingFunctions.scheme = WebInspector.NetworkDataGridNode.Request
PropertyComparator.bind(null, "scheme"); |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 hideEventDividers: function() | 604 hideEventDividers: function() |
602 { | 605 { |
603 this._timelineGrid.hideEventDividers(); | 606 this._timelineGrid.hideEventDividers(); |
604 }, | 607 }, |
605 | 608 |
606 showEventDividers: function() | 609 showEventDividers: function() |
607 { | 610 { |
608 this._timelineGrid.showEventDividers(); | 611 this._timelineGrid.showEventDividers(); |
609 }, | 612 }, |
610 | 613 |
611 /** | 614 _updateRowsSize: function() |
612 * @param {!WebInspector.Event} event | |
613 */ | |
614 _updateRowsSize: function(event) | |
615 { | 615 { |
616 this._timelineGrid.element.classList.toggle("small", !event.data); | 616 this._timelineGrid.element.classList.toggle("small", !this._networkLogLa
rgeRowsSetting.get()); |
617 } | 617 } |
618 } | 618 } |
OLD | NEW |