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

Side by Side Diff: Source/devtools/front_end/network/NetworkPanel.js

Issue 667743002: DevTools: remove "type" getters in Resource and NetworkRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 } 1211 }
1212 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Copy all as HAR" : "Copy All as HAR"), this._copyAll.bind(this)); 1212 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Copy all as HAR" : "Copy All as HAR"), this._copyAll.bind(this));
1213 1213
1214 contextMenu.appendSeparator(); 1214 contextMenu.appendSeparator();
1215 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Save as HAR with content" : "Save as HAR with Content"), this._exp ortAll.bind(this)); 1215 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Save as HAR with content" : "Save as HAR with Content"), this._exp ortAll.bind(this));
1216 1216
1217 contextMenu.appendSeparator(); 1217 contextMenu.appendSeparator();
1218 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Clear browser cache" : "Clear Browser Cache"), this._clearBrowserC ache.bind(this)); 1218 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Clear browser cache" : "Clear Browser Cache"), this._clearBrowserC ache.bind(this));
1219 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Clear browser cookies" : "Clear Browser Cookies"), this._clearBrow serCookies.bind(this)); 1219 contextMenu.appendItem(WebInspector.UIString(WebInspector.useLowerCaseMe nuTitles() ? "Clear browser cookies" : "Clear Browser Cookies"), this._clearBrow serCookies.bind(this));
1220 1220
1221 if (request && request.type === WebInspector.resourceTypes.XHR) { 1221 if (request && request.resourceType() === WebInspector.resourceTypes.XHR ) {
1222 contextMenu.appendSeparator(); 1222 contextMenu.appendSeparator();
1223 contextMenu.appendItem(WebInspector.UIString("Replay XHR"), this._re playXHR.bind(this, request.requestId)); 1223 contextMenu.appendItem(WebInspector.UIString("Replay XHR"), this._re playXHR.bind(this, request.requestId));
1224 contextMenu.appendSeparator(); 1224 contextMenu.appendSeparator();
1225 } 1225 }
1226 1226
1227 contextMenu.show(); 1227 contextMenu.show();
1228 }, 1228 },
1229 1229
1230 /** 1230 /**
1231 * @param {string} requestId 1231 * @param {string} requestId
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 return (index + this._matchedRequestCount) % this._matchedRequestCount; 1473 return (index + this._matchedRequestCount) % this._matchedRequestCount;
1474 }, 1474 },
1475 1475
1476 /** 1476 /**
1477 * @param {!WebInspector.NetworkDataGridNode} node 1477 * @param {!WebInspector.NetworkDataGridNode} node
1478 * @return {boolean} 1478 * @return {boolean}
1479 */ 1479 */
1480 _applyFilter: function(node) 1480 _applyFilter: function(node)
1481 { 1481 {
1482 var request = node.request(); 1482 var request = node.request();
1483 if (!this._resourceTypeFilterUI.accept(request.type.name())) 1483 if (!this._resourceTypeFilterUI.accept(request.resourceType().name()))
1484 return false; 1484 return false;
1485 if (this._dataURLFilterUI.checked() && request.parsedURL.isDataURL()) 1485 if (this._dataURLFilterUI.checked() && request.parsedURL.isDataURL())
1486 return false; 1486 return false;
1487 for (var i = 0; i < this._filters.length; ++i) { 1487 for (var i = 0; i < this._filters.length; ++i) {
1488 if (!this._filters[i](request)) 1488 if (!this._filters[i](request))
1489 return false; 1489 return false;
1490 } 1490 }
1491 return true; 1491 return true;
1492 }, 1492 },
1493 1493
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after
2772 _createTimelineBar: function(cell) 2772 _createTimelineBar: function(cell)
2773 { 2773 {
2774 cell = cell.createChild("div"); 2774 cell = cell.createChild("div");
2775 this._timelineCell = cell; 2775 this._timelineCell = cell;
2776 2776
2777 cell.className = "network-graph-side"; 2777 cell.className = "network-graph-side";
2778 2778
2779 this._barAreaElement = cell.createChild("div", "network-graph-bar-area") ; 2779 this._barAreaElement = cell.createChild("div", "network-graph-bar-area") ;
2780 this._barAreaElement.request = this._request; 2780 this._barAreaElement.request = this._request;
2781 2781
2782 var type = this._request.type.name(); 2782 var type = this._request.resourceType().name();
2783 var cached = this._request.cached(); 2783 var cached = this._request.cached();
2784 2784
2785 this._barLeftElement = this._barAreaElement.createChild("div", "network- graph-bar"); 2785 this._barLeftElement = this._barAreaElement.createChild("div", "network- graph-bar");
2786 this._barLeftElement.classList.add(type, "waiting"); 2786 this._barLeftElement.classList.add(type, "waiting");
2787 this._barLeftElement.classList.toggle("cached", cached); 2787 this._barLeftElement.classList.toggle("cached", cached);
2788 2788
2789 this._barRightElement = this._barAreaElement.createChild("div", "network -graph-bar"); 2789 this._barRightElement = this._barAreaElement.createChild("div", "network -graph-bar");
2790 this._barRightElement.classList.add(type); 2790 this._barRightElement.classList.add(type);
2791 this._barRightElement.classList.toggle("cached", cached); 2791 this._barRightElement.classList.toggle("cached", cached);
2792 2792
(...skipping 24 matching lines...) Expand all
2817 2817
2818 /** 2818 /**
2819 * @param {!Element} cell 2819 * @param {!Element} cell
2820 */ 2820 */
2821 _renderNameCell: function(cell) 2821 _renderNameCell: function(cell)
2822 { 2822 {
2823 this._nameCell = cell; 2823 this._nameCell = cell;
2824 cell.addEventListener("click", this._onClick.bind(this), false); 2824 cell.addEventListener("click", this._onClick.bind(this), false);
2825 cell.addEventListener("dblclick", this._openInNewTab.bind(this), false); 2825 cell.addEventListener("dblclick", this._openInNewTab.bind(this), false);
2826 var iconElement; 2826 var iconElement;
2827 if (this._request.type === WebInspector.resourceTypes.Image) { 2827 if (this._request.resourceType() === WebInspector.resourceTypes.Image) {
2828 var previewImage = createElementWithClass("img", "image-network-icon -preview"); 2828 var previewImage = createElementWithClass("img", "image-network-icon -preview");
2829 this._request.populateImageSource(previewImage); 2829 this._request.populateImageSource(previewImage);
2830 2830
2831 iconElement = createElementWithClass("div", "icon"); 2831 iconElement = createElementWithClass("div", "icon");
2832 iconElement.appendChild(previewImage); 2832 iconElement.appendChild(previewImage);
2833 } else { 2833 } else {
2834 iconElement = createElementWithClass("img", "icon"); 2834 iconElement = createElementWithClass("img", "icon");
2835 } 2835 }
2836 iconElement.classList.add(this._request.type.name()); 2836 iconElement.classList.add(this._request.resourceType().name());
2837 2837
2838 cell.appendChild(iconElement); 2838 cell.appendChild(iconElement);
2839 cell.createTextChild(this._request.name()); 2839 cell.createTextChild(this._request.name());
2840 this._appendSubtitle(cell, this._request.path()); 2840 this._appendSubtitle(cell, this._request.path());
2841 cell.title = this._request.url; 2841 cell.title = this._request.url;
2842 }, 2842 },
2843 2843
2844 /** 2844 /**
2845 * @param {!Element} cell 2845 * @param {!Element} cell
2846 */ 2846 */
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
3315 this._writeProgress.done(); 3315 this._writeProgress.done();
3316 return; 3316 return;
3317 } 3317 }
3318 const chunkSize = 100000; 3318 const chunkSize = 100000;
3319 var text = this._text.substring(this._bytesWritten, this._bytesWritten + chunkSize); 3319 var text = this._text.substring(this._bytesWritten, this._bytesWritten + chunkSize);
3320 this._bytesWritten += text.length; 3320 this._bytesWritten += text.length;
3321 stream.write(text, this._writeNextChunk.bind(this)); 3321 stream.write(text, this._writeNextChunk.bind(this));
3322 this._writeProgress.setWorked(this._bytesWritten); 3322 this._writeProgress.setWorked(this._bytesWritten);
3323 } 3323 }
3324 } 3324 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/network/NetworkItemView.js ('k') | Source/devtools/front_end/network/RequestPreviewView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698