| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> | 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> |
| 4 * Copyright (C) 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 /** | 31 /** |
| 32 * @unrestricted | 32 * @unrestricted |
| 33 */ | 33 */ |
| 34 Network.NetworkNode = class extends DataGrid.SortableDataGridNode { | 34 Network.NetworkNode = class extends DataGrid.SortableDataGridNode { |
| 35 /** | 35 /** |
| 36 * @param {!Network.NetworkLogView} parentView | 36 * @param {!Network.NetworkLogView} parentView |
| 37 */ | 37 */ |
| 38 constructor(parentView) { | 38 constructor(parentView) { |
| 39 super({}); | 39 super({}); |
| 40 this._parentView = parentView; | 40 this._parentView = parentView; |
| 41 /** @type {!Map<string, ?Network.NetworkColumnExtensionInterface>} */ |
| 42 this._columnExtensions = new Map(); |
| 41 this._isHovered = false; | 43 this._isHovered = false; |
| 42 this._showingInitiatorChain = false; | 44 this._showingInitiatorChain = false; |
| 43 /** @type {?SDK.NetworkRequest} */ | 45 /** @type {?SDK.NetworkRequest} */ |
| 44 this._requestOrFirstKnownChildRequest = null; | 46 this._requestOrFirstKnownChildRequest = null; |
| 45 } | 47 } |
| 46 | 48 |
| 47 /** | 49 /** |
| 48 * @return {!Network.NetworkLogView} | 50 * @return {!Network.NetworkLogView} |
| 49 */ | 51 */ |
| 50 parentView() { | 52 parentView() { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 67 | 69 |
| 68 /** | 70 /** |
| 69 * @override | 71 * @override |
| 70 * @return {number} | 72 * @return {number} |
| 71 */ | 73 */ |
| 72 nodeSelfHeight() { | 74 nodeSelfHeight() { |
| 73 return this._parentView.rowHeight(); | 75 return this._parentView.rowHeight(); |
| 74 } | 76 } |
| 75 | 77 |
| 76 /** | 78 /** |
| 79 * @param {!Map<string, ?Network.NetworkColumnExtensionInterface>} columnExten
sions |
| 80 */ |
| 81 setColumnExtensions(columnExtensions) { |
| 82 this._columnExtensions = columnExtensions; |
| 83 } |
| 84 |
| 85 /** |
| 77 * @param {boolean} hovered | 86 * @param {boolean} hovered |
| 78 * @param {boolean} showInitiatorChain | 87 * @param {boolean} showInitiatorChain |
| 79 */ | 88 */ |
| 80 setHovered(hovered, showInitiatorChain) { | 89 setHovered(hovered, showInitiatorChain) { |
| 81 if (this._isHovered === hovered && this._showingInitiatorChain === showIniti
atorChain) | 90 if (this._isHovered === hovered && this._showingInitiatorChain === showIniti
atorChain) |
| 82 return; | 91 return; |
| 83 if (this._isHovered !== hovered) { | 92 if (this._isHovered !== hovered) { |
| 84 this._isHovered = hovered; | 93 this._isHovered = hovered; |
| 85 if (this.attached()) | 94 if (this.attached()) |
| 86 this.element().classList.toggle('hover', hovered); | 95 this.element().classList.toggle('hover', hovered); |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 var aHeader = aRequest.responseHeaderValue(propertyName); | 466 var aHeader = aRequest.responseHeaderValue(propertyName); |
| 458 var bHeader = bRequest.responseHeaderValue(propertyName); | 467 var bHeader = bRequest.responseHeaderValue(propertyName); |
| 459 var aValue = aHeader ? new Date(aHeader).getTime() : -Infinity; | 468 var aValue = aHeader ? new Date(aHeader).getTime() : -Infinity; |
| 460 var bValue = bHeader ? new Date(bHeader).getTime() : -Infinity; | 469 var bValue = bHeader ? new Date(bHeader).getTime() : -Infinity; |
| 461 if (aValue === bValue) | 470 if (aValue === bValue) |
| 462 return aRequest.indentityCompare(bRequest); | 471 return aRequest.indentityCompare(bRequest); |
| 463 return aValue > bValue ? 1 : -1; | 472 return aValue > bValue ? 1 : -1; |
| 464 } | 473 } |
| 465 | 474 |
| 466 /** | 475 /** |
| 476 * @param {!Map<string, ?Network.NetworkColumnExtensionInterface>} extensionsM
ap |
| 477 * @param {string} extensionId |
| 478 * @param {!Network.NetworkNode} a |
| 479 * @param {!Network.NetworkNode} b |
| 480 * @return {number} |
| 481 */ |
| 482 static ExtensionColumnComparator(extensionsMap, extensionId, a, b) { |
| 483 var aRequest = a.requestOrFirstKnownChildRequest(); |
| 484 var bRequest = b.requestOrFirstKnownChildRequest(); |
| 485 if (!aRequest || !bRequest) |
| 486 return !aRequest ? -1 : 1; |
| 487 var instance = extensionsMap.get(extensionId); |
| 488 if (!instance) |
| 489 return aRequest.indentityCompare(bRequest); |
| 490 return instance.requestComparator(aRequest, bRequest); |
| 491 } |
| 492 |
| 493 /** |
| 467 * @override | 494 * @override |
| 468 */ | 495 */ |
| 469 showingInitiatorChainChanged() { | 496 showingInitiatorChainChanged() { |
| 470 var showInitiatorChain = this.showingInitiatorChain(); | 497 var showInitiatorChain = this.showingInitiatorChain(); |
| 471 | 498 |
| 472 var initiatorGraph = SDK.NetworkLog.initiatorGraphForRequest(this._request); | 499 var initiatorGraph = SDK.NetworkLog.initiatorGraphForRequest(this._request); |
| 473 for (var request of initiatorGraph.initiators) { | 500 for (var request of initiatorGraph.initiators) { |
| 474 if (request === this._request) | 501 if (request === this._request) |
| 475 continue; | 502 continue; |
| 476 var node = this.parentView().nodeForRequest(request); | 503 var node = this.parentView().nodeForRequest(request); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 element.title = text; | 624 element.title = text; |
| 598 } | 625 } |
| 599 | 626 |
| 600 /** | 627 /** |
| 601 * @override | 628 * @override |
| 602 * @param {string} columnIdentifier | 629 * @param {string} columnIdentifier |
| 603 * @return {!Element} | 630 * @return {!Element} |
| 604 */ | 631 */ |
| 605 createCell(columnIdentifier) { | 632 createCell(columnIdentifier) { |
| 606 var cell = this.createTD(columnIdentifier); | 633 var cell = this.createTD(columnIdentifier); |
| 634 // If the key exists but the value is null it means the extension instance h
as not resolved yet. |
| 635 // The view controller will force all rows to update when extension is resol
ved. |
| 636 if (this._columnExtensions.has(columnIdentifier)) { |
| 637 var instance = this._columnExtensions.get(columnIdentifier); |
| 638 if (instance) |
| 639 this._setTextAndTitle(cell, instance.lookupColumnValue(this._request)); |
| 640 return cell; |
| 641 } |
| 607 switch (columnIdentifier) { | 642 switch (columnIdentifier) { |
| 608 case 'name': | 643 case 'name': |
| 609 this._renderNameCell(cell); | 644 this._renderNameCell(cell); |
| 610 break; | 645 break; |
| 611 case 'method': | 646 case 'method': |
| 612 this._setTextAndTitle(cell, this._request.requestMethod); | 647 this._setTextAndTitle(cell, this._request.requestMethod); |
| 613 break; | 648 break; |
| 614 case 'status': | 649 case 'status': |
| 615 this._renderStatusCell(cell); | 650 this._renderStatusCell(cell); |
| 616 break; | 651 break; |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 element.title = text; | 982 element.title = text; |
| 948 } | 983 } |
| 949 | 984 |
| 950 /** | 985 /** |
| 951 * @override | 986 * @override |
| 952 * @param {string} columnIdentifier | 987 * @param {string} columnIdentifier |
| 953 * @return {!Element} | 988 * @return {!Element} |
| 954 */ | 989 */ |
| 955 createCell(columnIdentifier) { | 990 createCell(columnIdentifier) { |
| 956 var cell = this.createTD(columnIdentifier); | 991 var cell = this.createTD(columnIdentifier); |
| 992 if (this._columnExtensions.has(columnIdentifier)) |
| 993 return cell; |
| 957 if (columnIdentifier === 'name') { | 994 if (columnIdentifier === 'name') { |
| 958 var leftPadding = this.leftPadding ? this.leftPadding + 'px' : ''; | 995 var leftPadding = this.leftPadding ? this.leftPadding + 'px' : ''; |
| 959 cell.style.setProperty('padding-left', leftPadding); | 996 cell.style.setProperty('padding-left', leftPadding); |
| 960 cell.classList.add('disclosure'); | 997 cell.classList.add('disclosure'); |
| 961 this._setTextAndTitle(cell, this._displayName); | 998 this._setTextAndTitle(cell, this._displayName); |
| 962 } | 999 } |
| 963 return cell; | 1000 return cell; |
| 964 } | 1001 } |
| 965 | 1002 |
| 966 /** | 1003 /** |
| 967 * @override | 1004 * @override |
| 968 * @param {boolean=} supressSelectedEvent | 1005 * @param {boolean=} supressSelectedEvent |
| 969 */ | 1006 */ |
| 970 select(supressSelectedEvent) { | 1007 select(supressSelectedEvent) { |
| 971 if (this.expanded) { | 1008 if (this.expanded) { |
| 972 this.collapse(); | 1009 this.collapse(); |
| 973 return; | 1010 return; |
| 974 } | 1011 } |
| 975 this.expand(); | 1012 this.expand(); |
| 976 } | 1013 } |
| 977 }; | 1014 }; |
| OLD | NEW |