Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkDataGridNode.js

Issue 2876983002: DevTools: group by frame, not product in the network panel. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 this._isProduct = false; 42 this._isProduct = false;
43 this._showingInitiatorChain = false; 43 this._showingInitiatorChain = false;
44 /** @type {?SDK.NetworkRequest} */ 44 /** @type {?SDK.NetworkRequest} */
45 this._requestOrFirstKnownChildRequest = null; 45 this._requestOrFirstKnownChildRequest = null;
46 } 46 }
47 47
48 /** 48 /**
49 * @param {!Network.NetworkNode._ProductEntryInfo} entryInfo 49 * @param {!Network.NetworkNode._ProductEntryInfo} entryInfo
50 */ 50 */
51 static buildReportLinkElement(entryInfo) { 51 static buildReportLinkElement(entryInfo) {
52 var shadowRoot = UI.createShadowRootWithCoreStyles(createElement('div'), 'ne twork/networkReportProductEntry.css'); 52 var element = createElement('div');
53 var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'network/network ReportProductEntry.css');
53 var content = shadowRoot.createChild('div', 'network-product-popover'); 54 var content = shadowRoot.createChild('div', 'network-product-popover');
54 55
55 var domainElement = content.createChild('div', 'network-product-domain'); 56 var domainElement = content.createChild('div', 'network-product-domain');
56 domainElement.textContent = entryInfo.matchedURL.domain(); 57 domainElement.textContent = entryInfo.matchedURL.domain();
57 58
58 var entryNameElement = content.createChild('div', 'network-product-entry-nam e'); 59 var entryNameElement = content.createChild('div', 'network-product-entry-nam e');
59 entryNameElement.textContent = entryInfo.entry.name; 60 entryNameElement.textContent = entryInfo.entry.name;
60 61
61 var matchedURL = entryInfo.matchedURL; 62 var matchedURL = entryInfo.matchedURL;
62 var reportLink = 63 var reportLink =
63 'https://docs.google.com/forms/d/e/1FAIpQLSchz2FdcQ-rRllzl8BbhWaTRRY-12B pPjW6Hr9e1-BpCA083w/viewform' + 64 'https://docs.google.com/forms/d/e/1FAIpQLSchz2FdcQ-rRllzl8BbhWaTRRY-12B pPjW6Hr9e1-BpCA083w/viewform' +
64 '?entry_1425918171=' + encodeURIComponent((matchedURL.domain() + matched URL.path).substr(0, 100)); 65 '?entry_1425918171=' + encodeURIComponent((matchedURL.domain() + matched URL.path).substr(0, 100));
65 content.appendChild(UI.createExternalLink(reportLink, 'Report mismatch', 'ne twork-report-product-link')); 66 content.appendChild(UI.createExternalLink(reportLink, 'Report mismatch', 'ne twork-report-product-link'));
66 return shadowRoot; 67 return element;
67 } 68 }
68 69
69 /** 70 /**
70 * @return {!Network.NetworkNode._SupportedBackgroundColors} 71 * @return {!Network.NetworkNode._SupportedBackgroundColors}
71 */ 72 */
72 static _themedBackgroundColors() { 73 static _themedBackgroundColors() {
73 if (Network.NetworkNode._themedBackgroundColorsCache) 74 if (Network.NetworkNode._themedBackgroundColorsCache)
74 return Network.NetworkNode._themedBackgroundColorsCache; 75 return Network.NetworkNode._themedBackgroundColorsCache;
75 var themedColors = {}; 76 var themedColors = {};
76 for (var name in Network.NetworkNode._backgroundColors) { 77 for (var name in Network.NetworkNode._backgroundColors) {
(...skipping 21 matching lines...) Expand all
98 parsedURL = new Common.ParsedURL(callFrame.url); 99 parsedURL = new Common.ParsedURL(callFrame.url);
99 entry = productRegistry.entryForUrl(parsedURL); 100 entry = productRegistry.entryForUrl(parsedURL);
100 return !!entry; 101 return !!entry;
101 }); 102 });
102 if (!entry) 103 if (!entry)
103 return null; 104 return null;
104 return {entry: entry, matchedURL: parsedURL}; 105 return {entry: entry, matchedURL: parsedURL};
105 } 106 }
106 107
107 /** 108 /**
108 * @protected
109 * @return {!Promise<?Network.NetworkNode._ProductEntryInfo>}
110 */
111 productEntry() {
112 return Promise.resolve(/** @type {?Network.NetworkNode._ProductEntryInfo} */ (null));
113 }
114
115 /**
116 * @param {!UI.PopoverRequest} popover
117 * @return {!Promise<boolean>}
118 */
119 handleProductPopover(popover) {
120 return this.productEntry().then(entryInfo => {
121 if (!entryInfo)
122 return false;
123 popover.setAnchorBehavior(UI.GlassPane.AnchorBehavior.PreferBottom);
124 popover.contentElement.appendChild(Network.NetworkNode.buildReportLinkElem ent(entryInfo));
125 return true;
126 });
127 }
128
129 /**
130 * @return {string} 109 * @return {string}
131 */ 110 */
132 displayName() { 111 displayName() {
133 return ''; 112 return '';
134 } 113 }
135 114
136 /** 115 /**
137 * @return {boolean} 116 * @return {boolean}
138 */ 117 */
139 isFromFrame() { 118 isFromFrame() {
(...skipping 22 matching lines...) Expand all
162 /** 141 /**
163 * @return {string} 142 * @return {string}
164 */ 143 */
165 backgroundColor() { 144 backgroundColor() {
166 var bgColors = Network.NetworkNode._themedBackgroundColors(); 145 var bgColors = Network.NetworkNode._themedBackgroundColors();
167 var color = this.isStriped() ? bgColors.Stripe : bgColors.Default; 146 var color = this.isStriped() ? bgColors.Stripe : bgColors.Default;
168 if (this.isNavigationRequest()) 147 if (this.isNavigationRequest())
169 color = color.blendWith(bgColors.Navigation); 148 color = color.blendWith(bgColors.Navigation);
170 if (this.hovered()) 149 if (this.hovered())
171 color = color.blendWith(bgColors.Hovered); 150 color = color.blendWith(bgColors.Hovered);
172 if (this.isFromFrame())
173 color = color.blendWith(bgColors.FromFrame);
174 else if (this._isProduct)
175 color = color.blendWith(bgColors.IsProduct);
176 if (this.isOnInitiatorPath()) 151 if (this.isOnInitiatorPath())
177 color = color.blendWith(bgColors.InitiatorPath); 152 color = color.blendWith(bgColors.InitiatorPath);
178 if (this.isOnInitiatedPath()) 153 if (this.isOnInitiatedPath())
179 color = color.blendWith(bgColors.InitiatedPath); 154 color = color.blendWith(bgColors.InitiatedPath);
180 if (this.selected) 155 if (this.selected)
181 color = color.blendWith(bgColors.Selected); 156 color = color.blendWith(bgColors.Selected);
182 157
183 return /** @type {string} */ (color.asString(Common.Color.Format.HEX)); 158 return /** @type {string} */ (color.asString(Common.Color.Format.HEX));
184 } 159 }
185 160
186 _updateBackgroundColor() { 161 _updateBackgroundColor() {
187 var element = this.existingElement(); 162 var element = this.existingElement();
188 if (!element) 163 if (!element)
189 return; 164 return;
165
166 element.classList.toggle('network-row-from-frame', this.isFromFrame());
167 element.classList.toggle('network-row-with-product', !this.isFromFrame() && this._isProduct);
190 element.style.backgroundColor = this.backgroundColor(); 168 element.style.backgroundColor = this.backgroundColor();
191 this._parentView.stylesChanged(); 169 this._parentView.stylesChanged();
192 } 170 }
193 171
194 /** 172 /**
195 * @override 173 * @override
196 * @param {boolean} isStriped 174 * @param {boolean} isStriped
197 */ 175 */
198 setStriped(isStriped) { 176 setStriped(isStriped) {
199 super.setStriped(isStriped); 177 super.setStriped(isStriped);
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 /** 779 /**
802 * @override 780 * @override
803 * @param {!Element} cell 781 * @param {!Element} cell
804 * @param {string} columnId 782 * @param {string} columnId
805 */ 783 */
806 renderCell(cell, columnId) { 784 renderCell(cell, columnId) {
807 switch (columnId) { 785 switch (columnId) {
808 case 'name': 786 case 'name':
809 this._renderNameCell(cell); 787 this._renderNameCell(cell);
810 break; 788 break;
811 case 'product':
812 if (!Runtime.experiments.isEnabled('networkGroupingRequests')) {
813 this._setTextAndTitle(cell, this._request.responseHeaderValue(columnId ) || '');
814 break;
815 }
816 this.productEntry().then(entryInfo => {
817 if (entryInfo)
818 cell.textContent = entryInfo.entry.name;
819 });
820 break;
821 case 'method': 789 case 'method':
822 this._setTextAndTitle(cell, this._request.requestMethod); 790 this._setTextAndTitle(cell, this._request.requestMethod);
823 break; 791 break;
824 case 'status': 792 case 'status':
825 this._renderStatusCell(cell); 793 this._renderStatusCell(cell);
826 break; 794 break;
827 case 'protocol': 795 case 'protocol':
828 this._setTextAndTitle(cell, this._request.protocol); 796 this._setTextAndTitle(cell, this._request.protocol);
829 break; 797 break;
830 case 'scheme': 798 case 'scheme':
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 } 925 }
958 iconElement.classList.add(this._request.resourceType().name()); 926 iconElement.classList.add(this._request.resourceType().name());
959 927
960 cell.appendChild(iconElement); 928 cell.appendChild(iconElement);
961 cell.createTextChild(this._request.networkManager().target().decorateLabel(t his._request.name())); 929 cell.createTextChild(this._request.networkManager().target().decorateLabel(t his._request.name()));
962 this._appendSubtitle(cell, this._request.path()); 930 this._appendSubtitle(cell, this._request.path());
963 cell.title = this._request.url(); 931 cell.title = this._request.url();
964 } 932 }
965 933
966 /** 934 /**
967 * @override
968 * @return {!Promise<?Network.NetworkNode._ProductEntryInfo>}
969 */
970 productEntry() {
971 return ProductRegistry.instance().then(productRegistry => {
972 var frame = SDK.ResourceTreeModel.frameForRequest(this._request);
973 var entry = /** @type {?ProductRegistry.Registry.ProductEntry} */ (null);
974 if (frame && frame.isMainFrame())
975 frame = null;
976 var entryInfo = frame ? Network.NetworkNode.productEntryInfoForFrame(produ ctRegistry, frame) : null;
977 if (entryInfo)
978 return entryInfo;
979 entry = productRegistry.entryForUrl(this._request.parsedURL);
980 return entry ? {entry: entry, matchedURL: this._request.parsedURL} : null;
981 });
982 }
983
984 /**
985 * @param {!Element} cell 935 * @param {!Element} cell
986 */ 936 */
987 _renderStatusCell(cell) { 937 _renderStatusCell(cell) {
988 cell.classList.toggle( 938 cell.classList.toggle(
989 'network-dim-cell', !this._isFailed() && (this._request.cached() || !thi s._request.statusCode)); 939 'network-dim-cell', !this._isFailed() && (this._request.cached() || !thi s._request.statusCode));
990 940
991 if (this._request.failed && !this._request.canceled && !this._request.wasBlo cked()) { 941 if (this._request.failed && !this._request.canceled && !this._request.wasBlo cked()) {
992 var failText = Common.UIString('(failed)'); 942 var failText = Common.UIString('(failed)');
993 if (this._request.localizedFailDescription) { 943 if (this._request.localizedFailDescription) {
994 cell.createTextChild(failText); 944 cell.createTextChild(failText);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 * @param {boolean=} supressSelectedEvent 1106 * @param {boolean=} supressSelectedEvent
1157 */ 1107 */
1158 select(supressSelectedEvent) { 1108 select(supressSelectedEvent) {
1159 if (this.expanded) { 1109 if (this.expanded) {
1160 this.collapse(); 1110 this.collapse();
1161 return; 1111 return;
1162 } 1112 }
1163 this.expand(); 1113 this.expand();
1164 } 1114 }
1165 }; 1115 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698