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) |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 this._calculatorsMap.set(WebInspector.NetworkLogViewColumns._calculatorT
ypes.Time, timeCalculator); | 402 this._calculatorsMap.set(WebInspector.NetworkLogViewColumns._calculatorT
ypes.Time, timeCalculator); |
403 this._calculatorsMap.set(WebInspector.NetworkLogViewColumns._calculatorT
ypes.Duration, durationCalculator); | 403 this._calculatorsMap.set(WebInspector.NetworkLogViewColumns._calculatorT
ypes.Duration, durationCalculator); |
404 | 404 |
405 this._popoverHelper = new WebInspector.PopoverHelper(this._networkLogVie
w.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this), this
._onHidePopover.bind(this)); | 405 this._popoverHelper = new WebInspector.PopoverHelper(this._networkLogVie
w.element, this._getPopoverAnchor.bind(this), this._showPopover.bind(this), this
._onHidePopover.bind(this)); |
406 | 406 |
407 this._dataGrid = new WebInspector.SortableDataGrid(this._columns.map(Web
Inspector.NetworkLogViewColumns._convertToDataGridDescriptor)); | 407 this._dataGrid = new WebInspector.SortableDataGrid(this._columns.map(Web
Inspector.NetworkLogViewColumns._convertToDataGridDescriptor)); |
408 | 408 |
409 this._updateColumns(); | 409 this._updateColumns(); |
410 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan
ged, this._sortHandler, this); | 410 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan
ged, this._sortHandler, this); |
411 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi
zed, this.updateDividersIfNeeded, this); | 411 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi
zed, this.updateDividersIfNeeded, this); |
| 412 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.HeaderConte
xtMenu, event => this._innerHeaderContextMenu(/** @type {!WebInspector.ContextMe
nu} */ (event.data))); |
412 | 413 |
413 this._timelineGrid = new WebInspector.TimelineGrid(); | 414 this._timelineGrid = new WebInspector.TimelineGrid(); |
414 this._timelineGrid.element.classList.add("network-timeline-grid"); | 415 this._timelineGrid.element.classList.add("network-timeline-grid"); |
415 if (!Runtime.experiments.isEnabled("canvasNetworkTimeline")) | 416 if (!Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
416 this._dataGrid.element.appendChild(this._timelineGrid.element); | 417 this._dataGrid.element.appendChild(this._timelineGrid.element); |
417 | 418 |
418 this._setupDropdownColumns(); | 419 this._setupDropdownColumns(); |
419 | 420 |
420 this._dataGrid.markColumnAsSortedBy(WebInspector.NetworkLogViewColumns._
initialSortColumn, WebInspector.DataGrid.Order.Ascending); | 421 this._dataGrid.markColumnAsSortedBy(WebInspector.NetworkLogViewColumns._
initialSortColumn, WebInspector.DataGrid.Order.Ascending); |
421 | 422 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 _makeHeaderFragment: function(title, subtitle) | 575 _makeHeaderFragment: function(title, subtitle) |
575 { | 576 { |
576 var fragment = createDocumentFragment(); | 577 var fragment = createDocumentFragment(); |
577 fragment.createTextChild(title); | 578 fragment.createTextChild(title); |
578 var subtitleDiv = fragment.createChild("div", "network-header-subtitle")
; | 579 var subtitleDiv = fragment.createChild("div", "network-header-subtitle")
; |
579 subtitleDiv.createTextChild(subtitle); | 580 subtitleDiv.createTextChild(subtitle); |
580 return fragment; | 581 return fragment; |
581 }, | 582 }, |
582 | 583 |
583 /** | 584 /** |
584 * @param {!Event} event | 585 * @param {!MouseEvent} event |
585 * @return {boolean} | |
586 */ | 586 */ |
587 contextMenu: function(event) | 587 headerContextMenuEvent: function(event) |
588 { | 588 { |
589 if (!this._gridMode || !event.target.isSelfOrDescendant(this._dataGrid.h
eaderTableBody())) | 589 // TODO(allada) Remove this entire function when new timeline moves to t
his file. |
590 return false; | 590 this._innerHeaderContextMenu(new WebInspector.ContextMenu(event)); |
| 591 }, |
591 | 592 |
| 593 /** |
| 594 * @param {!WebInspector.ContextMenu} contextMenu |
| 595 */ |
| 596 _innerHeaderContextMenu: function(contextMenu) |
| 597 { |
592 var columnConfigs = this._columns.filter(columnConfig => columnConfig.hi
deable); | 598 var columnConfigs = this._columns.filter(columnConfig => columnConfig.hi
deable); |
593 var contextMenu = new WebInspector.ContextMenu(event); | |
594 var nonResponseHeaders = columnConfigs.filter(columnConfig => !columnCon
fig.isResponseHeader); | 599 var nonResponseHeaders = columnConfigs.filter(columnConfig => !columnCon
fig.isResponseHeader); |
595 for (var columnConfig of nonResponseHeaders) | 600 for (var columnConfig of nonResponseHeaders) |
596 contextMenu.appendCheckboxItem(columnConfig.title, this._toggleColum
nVisibility.bind(this, columnConfig), columnConfig.visible); | 601 contextMenu.appendCheckboxItem(columnConfig.title, this._toggleColum
nVisibility.bind(this, columnConfig), columnConfig.visible); |
597 | 602 |
598 contextMenu.appendSeparator(); | 603 contextMenu.appendSeparator(); |
599 | 604 |
600 var responseSubMenu = contextMenu.appendSubMenuItem(WebInspector.UIStrin
g("Response Headers")); | 605 var responseSubMenu = contextMenu.appendSubMenuItem(WebInspector.UIStrin
g("Response Headers")); |
601 var responseHeaders = columnConfigs.filter(columnConfig => columnConfig.
isResponseHeader); | 606 var responseHeaders = columnConfigs.filter(columnConfig => columnConfig.
isResponseHeader); |
602 for (var columnConfig of responseHeaders) | 607 for (var columnConfig of responseHeaders) |
603 responseSubMenu.appendCheckboxItem(columnConfig.title, this._toggleC
olumnVisibility.bind(this, columnConfig), columnConfig.visible); | 608 responseSubMenu.appendCheckboxItem(columnConfig.title, this._toggleC
olumnVisibility.bind(this, columnConfig), columnConfig.visible); |
604 | 609 |
605 responseSubMenu.appendSeparator(); | 610 responseSubMenu.appendSeparator(); |
606 responseSubMenu.appendItem(WebInspector.UIString("Manage Header Columns\
u2026"), this._manageCustomHeaderDialog.bind(this)); | 611 responseSubMenu.appendItem(WebInspector.UIString("Manage Header Columns\
u2026"), this._manageCustomHeaderDialog.bind(this)); |
607 | 612 |
608 contextMenu.show(); | 613 contextMenu.show(); |
609 return true; | |
610 }, | 614 }, |
611 | 615 |
612 _manageCustomHeaderDialog: function() | 616 _manageCustomHeaderDialog: function() |
613 { | 617 { |
614 var customHeaders = []; | 618 var customHeaders = []; |
615 for (var columnConfig of this._columns) { | 619 for (var columnConfig of this._columns) { |
616 if (columnConfig.isResponseHeader) | 620 if (columnConfig.isResponseHeader) |
617 customHeaders.push({title: columnConfig.title, editable: columnC
onfig.isCustomHeader}); | 621 customHeaders.push({title: columnConfig.title, editable: columnC
onfig.isCustomHeader}); |
618 } | 622 } |
619 var manageCustomHeaders = new WebInspector.NetworkManageCustomHeadersVie
w(customHeaders, headerTitle => !!this._addCustomHeader(headerTitle), this._chan
geCustomHeader.bind(this), this._removeCustomHeader.bind(this)); | 623 var manageCustomHeaders = new WebInspector.NetworkManageCustomHeadersVie
w(customHeaders, headerTitle => !!this._addCustomHeader(headerTitle), this._chan
geCustomHeader.bind(this), this._removeCustomHeader.bind(this)); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 divider.element.classList.toggle("network-frame-divider-selected", f
alse); | 835 divider.element.classList.toggle("network-frame-divider-selected", f
alse); |
832 }, | 836 }, |
833 | 837 |
834 _updateRowsSize: function() | 838 _updateRowsSize: function() |
835 { | 839 { |
836 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) | 840 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) |
837 return; | 841 return; |
838 this._timelineGrid.element.classList.toggle("small", !this._networkLogLa
rgeRowsSetting.get()); | 842 this._timelineGrid.element.classList.toggle("small", !this._networkLogLa
rgeRowsSetting.get()); |
839 } | 843 } |
840 }; | 844 }; |
OLD | NEW |