| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 * @implements {Network.GroupLookupInterface} | 6 * @implements {Network.GroupLookupInterface} |
| 7 */ | 7 */ |
| 8 Network.FrameGrouper = class { | 8 Network.FrameGrouper = class { |
| 9 /** | 9 /** |
| 10 * @param {!Network.NetworkLogView} parentView | 10 * @param {!Network.NetworkLogView} parentView |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 Network.FrameGroupNode = class extends Network.NetworkGroupNode { | 56 Network.FrameGroupNode = class extends Network.NetworkGroupNode { |
| 57 /** | 57 /** |
| 58 * @param {!Network.NetworkLogView} parentView | 58 * @param {!Network.NetworkLogView} parentView |
| 59 * @param {!SDK.ResourceTreeFrame} frame | 59 * @param {!SDK.ResourceTreeFrame} frame |
| 60 * @param {!Network.FrameGrouper} grouper | 60 * @param {!Network.FrameGrouper} grouper |
| 61 */ | 61 */ |
| 62 constructor(parentView, frame, grouper) { | 62 constructor(parentView, frame, grouper) { |
| 63 super(parentView); | 63 super(parentView); |
| 64 this._frame = frame; | 64 this._frame = frame; |
| 65 this._grouper = grouper; | 65 this._grouper = grouper; |
| 66 /** @type {?ProductRegistry.Registry.ProductEntry|undefined} */ | 66 /** @type {?Network.NetworkNode._ProductEntryInfo|undefined} */ |
| 67 this._productEntryCache; | 67 this._productInfoEntryCache; |
| 68 } | 68 } |
| 69 | 69 |
| 70 /** | 70 /** |
| 71 * @override | 71 * @override |
| 72 * @return {boolean} | 72 * @return {boolean} |
| 73 */ | 73 */ |
| 74 isFromFrame() { | 74 isFromFrame() { |
| 75 return true; | 75 return true; |
| 76 } | 76 } |
| 77 | 77 |
| 78 /** | 78 /** |
| 79 * @override | 79 * @override |
| 80 */ | 80 */ |
| 81 displayName() { | 81 displayName() { |
| 82 var entry = this._entry(); | 82 var entryInfo = this._innerProductEntry(); |
| 83 return entry ? entry.name : (new Common.ParsedURL(this._frame.url)).host ||
this._frame.name || '<iframe>'; | 83 return entryInfo ? entryInfo.entry.name : |
| 84 (new Common.ParsedURL(this._frame.url)).host || this._fra
me.name || '<iframe>'; |
| 84 } | 85 } |
| 85 | 86 |
| 86 /** | 87 /** |
| 87 * @override | 88 * @override |
| 88 * @param {!Element} cell | 89 * @param {!Element} cell |
| 89 * @param {string} columnId | 90 * @param {string} columnId |
| 90 */ | 91 */ |
| 91 renderCell(cell, columnId) { | 92 renderCell(cell, columnId) { |
| 92 super.renderCell(cell, columnId); | 93 super.renderCell(cell, columnId); |
| 93 if (columnId === 'name') { | 94 if (columnId === 'name') { |
| 94 var name = this.displayName(); | 95 var name = this.displayName(); |
| 95 cell.textContent = name; | 96 cell.textContent = name; |
| 96 cell.title = name; | 97 cell.title = name; |
| 97 } | 98 } |
| 98 if (columnId === 'product') { | 99 if (columnId === 'product') { |
| 99 var entry = this._entry(); | 100 var entryInfo = this._innerProductEntry(); |
| 100 if (!entry) | 101 if (entryInfo) |
| 101 return; | 102 cell.textContent = entryInfo.entry.name; |
| 102 cell.textContent = entry.name; | |
| 103 cell.title = entry.name; | |
| 104 } | 103 } |
| 105 } | 104 } |
| 106 | 105 |
| 107 /** | 106 /** |
| 108 * @return {?ProductRegistry.Registry.ProductEntry} | 107 * @override |
| 108 * @return {!Promise<?Network.NetworkNode._ProductEntryInfo>} |
| 109 */ | 109 */ |
| 110 _entry() { | 110 productEntry() { |
| 111 if (this._productEntryCache !== undefined) | 111 return Promise.resolve(this._innerProductEntry()); |
| 112 return this._productEntryCache; | 112 } |
| 113 |
| 114 /** |
| 115 * @return {?Network.NetworkNode._ProductEntryInfo} |
| 116 */ |
| 117 _innerProductEntry() { |
| 118 if (this._productInfoEntryCache !== undefined) |
| 119 return this._productInfoEntryCache; |
| 113 var productRegistry = this._grouper._productRegistry; | 120 var productRegistry = this._grouper._productRegistry; |
| 114 if (!productRegistry) | 121 if (!productRegistry) |
| 115 return null; | 122 return null; |
| 116 this._productEntryCache = productRegistry.entryForFrame(this._frame); | 123 this._productInfoEntryCache = Network.NetworkNode.productEntryInfoForFrame(p
roductRegistry, this._frame); |
| 117 return this._productEntryCache; | 124 return this._productInfoEntryCache; |
| 118 } | 125 } |
| 119 }; | 126 }; |
| OLD | NEW |