| 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 Network.NetworkLogViewColumns = class { | 7 Network.NetworkLogViewColumns = class { |
| 8 /** | 8 /** |
| 9 * @param {!Network.NetworkLogView} networkLogView | 9 * @param {!Network.NetworkLogView} networkLogView |
| 10 * @param {!Network.NetworkTransferTimeCalculator} timeCalculator | 10 * @param {!Network.NetworkTransferTimeCalculator} timeCalculator |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 var columnConfig = /** @type {!Network.NetworkLogViewColumns.Descriptor} *
/ ( | 85 var columnConfig = /** @type {!Network.NetworkLogViewColumns.Descriptor} *
/ ( |
| 86 Object.assign({}, defaultColumnConfig, currentConfigColumn)); | 86 Object.assign({}, defaultColumnConfig, currentConfigColumn)); |
| 87 columnConfig.id = columnConfig.id; | 87 columnConfig.id = columnConfig.id; |
| 88 if (columnConfig.subtitle) | 88 if (columnConfig.subtitle) |
| 89 columnConfig.titleDOMFragment = this._makeHeaderFragment(columnConfig.ti
tle, columnConfig.subtitle); | 89 columnConfig.titleDOMFragment = this._makeHeaderFragment(columnConfig.ti
tle, columnConfig.subtitle); |
| 90 this._columns.push(columnConfig); | 90 this._columns.push(columnConfig); |
| 91 } | 91 } |
| 92 this._loadColumnExtensions(); | 92 this._loadColumnExtensions(); |
| 93 this._loadCustomColumnsAndSettings(); | 93 this._loadCustomColumnsAndSettings(); |
| 94 | 94 |
| 95 this._popoverHelper = new UI.PopoverHelper(this._networkLogView.element); | 95 this._popoverHelper = new UI.PopoverHelper(this._networkLogView.element, thi
s._getPopoverRequest.bind(this)); |
| 96 this._popoverHelper.initializeCallbacks( | |
| 97 this._getPopoverAnchor.bind(this), this._showPopover.bind(this), this._o
nHidePopover.bind(this)); | |
| 98 this._popoverHelper.setHasPadding(true); | 96 this._popoverHelper.setHasPadding(true); |
| 99 | 97 |
| 100 /** @type {!DataGrid.SortableDataGrid<!Network.NetworkNode>} */ | 98 /** @type {!DataGrid.SortableDataGrid<!Network.NetworkNode>} */ |
| 101 this._dataGrid = | 99 this._dataGrid = |
| 102 new DataGrid.SortableDataGrid(this._columns.map(Network.NetworkLogViewCo
lumns._convertToDataGridDescriptor)); | 100 new DataGrid.SortableDataGrid(this._columns.map(Network.NetworkLogViewCo
lumns._convertToDataGridDescriptor)); |
| 103 this._dataGrid.element.addEventListener('mousedown', event => { | 101 this._dataGrid.element.addEventListener('mousedown', event => { |
| 104 if (!this._dataGrid.selectedNode && event.button) | 102 if (!this._dataGrid.selectedNode && event.button) |
| 105 event.consume(); | 103 event.consume(); |
| 106 }, true); | 104 }, true); |
| 107 | 105 |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 var currentColumnConfig = this._columns.find(columnConfig => columnConfig.id
=== newHeaderId); | 561 var currentColumnConfig = this._columns.find(columnConfig => columnConfig.id
=== newHeaderId); |
| 564 if (!oldColumnConfig || (currentColumnConfig && oldHeaderId !== newHeaderId)
) | 562 if (!oldColumnConfig || (currentColumnConfig && oldHeaderId !== newHeaderId)
) |
| 565 return false; | 563 return false; |
| 566 | 564 |
| 567 this._removeCustomHeader(oldHeaderId); | 565 this._removeCustomHeader(oldHeaderId); |
| 568 this._addCustomHeader(newHeaderTitle, newHeaderId, oldIndex); | 566 this._addCustomHeader(newHeaderTitle, newHeaderId, oldIndex); |
| 569 return true; | 567 return true; |
| 570 } | 568 } |
| 571 | 569 |
| 572 /** | 570 /** |
| 573 * @param {!Element} element | |
| 574 * @param {!Event} event | 571 * @param {!Event} event |
| 575 * @return {!Element|!AnchorBox|undefined} | 572 * @return {?UI.PopoverRequest} |
| 576 */ | 573 */ |
| 577 _getPopoverAnchor(element, event) { | 574 _getPopoverRequest(event) { |
| 578 if (!this._gridMode) | 575 if (!this._gridMode) |
| 579 return; | 576 return null; |
| 580 var anchor = element.enclosingNodeOrSelfWithClass('network-script-initiated'
); | 577 |
| 581 if (anchor && anchor.request) { | 578 var anchor = event.target.enclosingNodeOrSelfWithClass('network-script-initi
ated'); |
| 582 var initiator = /** @type {!SDK.NetworkRequest} */ (anchor.request).initia
tor(); | 579 var request = /** @type {?SDK.NetworkRequest} */ (anchor ? anchor.request :
null); |
| 583 if (initiator && initiator.stack) | 580 var initiator = request ? request.initiator() : null; |
| 584 return anchor; | 581 if (!initiator || !initiator.stack) |
| 585 } | 582 return null; |
| 583 |
| 584 return { |
| 585 box: anchor.boxInWindow(), |
| 586 show: popover => { |
| 587 var content = Components.DOMPresentationUtils.buildStackTracePreviewCont
ents( |
| 588 anchor.request.target(), this._popupLinkifier, initiator.stack); |
| 589 popover.contentElement.appendChild(content); |
| 590 return Promise.resolve(true); |
| 591 }, |
| 592 hide: () => { |
| 593 this._popupLinkifier.reset(); |
| 594 } |
| 595 }; |
| 586 } | 596 } |
| 587 | 597 |
| 588 /** | 598 /** |
| 589 * @param {!Element|!AnchorBox} anchor | |
| 590 * @param {!UI.GlassPane} popover | |
| 591 * @return {!Promise<boolean>} | |
| 592 */ | |
| 593 _showPopover(anchor, popover) { | |
| 594 var request = /** @type {!SDK.NetworkRequest} */ (anchor.request); | |
| 595 var initiator = /** @type {!Protocol.Network.Initiator} */ (request.initiato
r()); | |
| 596 var content = Components.DOMPresentationUtils.buildStackTracePreviewContents
( | |
| 597 request.target(), this._popupLinkifier, initiator.stack); | |
| 598 popover.contentElement.appendChild(content); | |
| 599 return Promise.resolve(true); | |
| 600 } | |
| 601 | |
| 602 _onHidePopover() { | |
| 603 this._popupLinkifier.reset(); | |
| 604 } | |
| 605 | |
| 606 /** | |
| 607 * @param {!Array<number>} times | 599 * @param {!Array<number>} times |
| 608 * @param {string} className | 600 * @param {string} className |
| 609 */ | 601 */ |
| 610 addEventDividers(times, className) { | 602 addEventDividers(times, className) { |
| 611 // TODO(allada) Remove this and pass in the color. | 603 // TODO(allada) Remove this and pass in the color. |
| 612 var color = 'transparent'; | 604 var color = 'transparent'; |
| 613 switch (className) { | 605 switch (className) { |
| 614 case 'network-blue-divider': | 606 case 'network-blue-divider': |
| 615 color = 'hsla(240, 100%, 80%, 0.7)'; | 607 color = 'hsla(240, 100%, 80%, 0.7)'; |
| 616 break; | 608 break; |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 */ | 867 */ |
| 876 lookupColumnValue(request) {}, | 868 lookupColumnValue(request) {}, |
| 877 | 869 |
| 878 /** | 870 /** |
| 879 * @param {!SDK.NetworkRequest} aRequest | 871 * @param {!SDK.NetworkRequest} aRequest |
| 880 * @param {!SDK.NetworkRequest} bRequest | 872 * @param {!SDK.NetworkRequest} bRequest |
| 881 * @return {number} | 873 * @return {number} |
| 882 */ | 874 */ |
| 883 requestComparator(aRequest, bRequest) {} | 875 requestComparator(aRequest, bRequest) {} |
| 884 }; | 876 }; |
| OLD | NEW |