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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 {?Network.NetworkNode._ProductEntryInfo|undefined} */ | 66 /** @type {?Network.NetworkNode._ProductEntryInfo|undefined} */ |
67 this._productInfoEntryCache; | 67 this._productInfoEntryCache; |
68 } | 68 } |
69 | 69 |
70 /** | 70 /** |
| 71 * @param {!UI.PopoverRequest} popover |
| 72 * @return {!Promise<boolean>} |
| 73 */ |
| 74 handleProductPopover(popover) { |
| 75 var entryInfo = this._innerProductEntry(); |
| 76 if (!entryInfo) |
| 77 return Promise.resolve(false); |
| 78 popover.setAnchorBehavior(UI.GlassPane.AnchorBehavior.PreferBottom); |
| 79 popover.contentElement.appendChild(Network.NetworkNode.buildReportLinkElemen
t(entryInfo)); |
| 80 return Promise.resolve(true); |
| 81 } |
| 82 |
| 83 /** |
71 * @override | 84 * @override |
72 * @return {boolean} | 85 * @return {boolean} |
73 */ | 86 */ |
74 isFromFrame() { | 87 isFromFrame() { |
75 return true; | 88 return true; |
76 } | 89 } |
77 | 90 |
78 /** | 91 /** |
79 * @override | 92 * @override |
80 */ | 93 */ |
81 displayName() { | 94 displayName() { |
82 var entryInfo = this._innerProductEntry(); | 95 var entryInfo = this._innerProductEntry(); |
83 return entryInfo ? entryInfo.entry.name : | 96 return entryInfo ? entryInfo.entry.name : |
84 (new Common.ParsedURL(this._frame.url)).host || this._fra
me.name || '<iframe>'; | 97 (new Common.ParsedURL(this._frame.url)).host || this._fra
me.name || '<iframe>'; |
85 } | 98 } |
86 | 99 |
87 /** | 100 /** |
88 * @override | 101 * @override |
89 * @param {!Element} cell | 102 * @param {!Element} cell |
90 * @param {string} columnId | 103 * @param {string} columnId |
91 */ | 104 */ |
92 renderCell(cell, columnId) { | 105 renderCell(cell, columnId) { |
93 super.renderCell(cell, columnId); | 106 super.renderCell(cell, columnId); |
94 if (columnId === 'name') { | 107 if (columnId === 'name') |
95 var name = this.displayName(); | 108 cell.textContent = this.displayName(); |
96 cell.textContent = name; | |
97 cell.title = name; | |
98 } | |
99 if (columnId === 'product') { | |
100 var entryInfo = this._innerProductEntry(); | |
101 if (entryInfo) | |
102 cell.textContent = entryInfo.entry.name; | |
103 } | |
104 } | 109 } |
105 | 110 |
106 /** | 111 /** |
107 * @override | |
108 * @return {!Promise<?Network.NetworkNode._ProductEntryInfo>} | |
109 */ | |
110 productEntry() { | |
111 return Promise.resolve(this._innerProductEntry()); | |
112 } | |
113 | |
114 /** | |
115 * @return {?Network.NetworkNode._ProductEntryInfo} | 112 * @return {?Network.NetworkNode._ProductEntryInfo} |
116 */ | 113 */ |
117 _innerProductEntry() { | 114 _innerProductEntry() { |
118 if (this._productInfoEntryCache !== undefined) | 115 if (this._productInfoEntryCache !== undefined) |
119 return this._productInfoEntryCache; | 116 return this._productInfoEntryCache; |
120 var productRegistry = this._grouper._productRegistry; | 117 var productRegistry = this._grouper._productRegistry; |
121 if (!productRegistry) | 118 if (!productRegistry) |
122 return null; | 119 return null; |
123 this._productInfoEntryCache = Network.NetworkNode.productEntryInfoForFrame(p
roductRegistry, this._frame); | 120 this._productInfoEntryCache = Network.NetworkNode.productEntryInfoForFrame(p
roductRegistry, this._frame); |
124 return this._productInfoEntryCache; | 121 return this._productInfoEntryCache; |
125 } | 122 } |
126 }; | 123 }; |
OLD | NEW |