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

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

Issue 411263003: DevTools: Extract SortableDataGrid. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 354
355 columns.push({ 355 columns.push({
356 id: "timeline", 356 id: "timeline",
357 titleDOMFragment: document.createDocumentFragment(), 357 titleDOMFragment: document.createDocumentFragment(),
358 title: WebInspector.NetworkLogView._columnTitles["timeline"], 358 title: WebInspector.NetworkLogView._columnTitles["timeline"],
359 sortable: false, 359 sortable: false,
360 weight: 40, 360 weight: 40,
361 sort: WebInspector.DataGrid.Order.Ascending 361 sort: WebInspector.DataGrid.Order.Ascending
362 }); 362 });
363 363
364 this._dataGrid = new WebInspector.DataGrid(columns); 364 this._dataGrid = new WebInspector.SortableDataGrid(columns);
365 this._updateColumns(); 365 this._updateColumns();
366 this._dataGrid.setName("networkLog"); 366 this._dataGrid.setName("networkLog");
367 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last); 367 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last);
368 this._dataGrid.element.classList.add("network-log-grid"); 368 this._dataGrid.element.classList.add("network-log-grid");
369 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true); 369 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true);
370 this._dataGrid.show(this.element); 370 this._dataGrid.show(this.element);
371 371
372 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update. 372 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update.
373 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this); 373 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this);
374 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this); 374 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this);
(...skipping 2096 matching lines...) Expand 10 before | Expand all | Expand 10 after
2471 _upperBound: function(request) 2471 _upperBound: function(request)
2472 { 2472 {
2473 return request.duration; 2473 return request.duration;
2474 }, 2474 },
2475 2475
2476 __proto__: WebInspector.NetworkTimeCalculator.prototype 2476 __proto__: WebInspector.NetworkTimeCalculator.prototype
2477 } 2477 }
2478 2478
2479 /** 2479 /**
2480 * @constructor 2480 * @constructor
2481 * @extends {WebInspector.DataGridNode} 2481 * @extends {WebInspector.SortableDataGridNode}
2482 * @param {!WebInspector.NetworkLogView} parentView 2482 * @param {!WebInspector.NetworkLogView} parentView
2483 * @param {!WebInspector.NetworkRequest} request 2483 * @param {!WebInspector.NetworkRequest} request
2484 */ 2484 */
2485 WebInspector.NetworkDataGridNode = function(parentView, request) 2485 WebInspector.NetworkDataGridNode = function(parentView, request)
2486 { 2486 {
2487 WebInspector.DataGridNode.call(this, {}); 2487 WebInspector.SortableDataGridNode.call(this, {});
2488 this._parentView = parentView; 2488 this._parentView = parentView;
2489 this._request = request; 2489 this._request = request;
2490 this._linkifier = new WebInspector.Linkifier(); 2490 this._linkifier = new WebInspector.Linkifier();
2491 this._isFilteredOut = true; 2491 this._isFilteredOut = true;
2492 this._isMatchingSearchQuery = false; 2492 this._isMatchingSearchQuery = false;
2493 } 2493 }
2494 2494
2495 WebInspector.NetworkDataGridNode.prototype = { 2495 WebInspector.NetworkDataGridNode.prototype = {
2496 /** override */ 2496 /** override */
2497 createCells: function() 2497 createCells: function()
2498 { 2498 {
2499 this._nameCell = null; 2499 this._nameCell = null;
2500 this._timelineCell = null; 2500 this._timelineCell = null;
2501 2501
2502 var element = this._element; 2502 var element = this._element;
2503 element.classList.toggle("network-error-row", this._isFailed()); 2503 element.classList.toggle("network-error-row", this._isFailed());
2504 element.classList.toggle("resource-cached", this._request.cached); 2504 element.classList.toggle("resource-cached", this._request.cached);
2505 var typeClassName = "network-type-" + this._request.type.name(); 2505 var typeClassName = "network-type-" + this._request.type.name();
2506 if (!element.classList.contains(typeClassName)) { 2506 if (!element.classList.contains(typeClassName)) {
2507 element.removeMatchingStyleClasses("network-type-\\w+"); 2507 element.removeMatchingStyleClasses("network-type-\\w+");
2508 element.classList.add(typeClassName); 2508 element.classList.add(typeClassName);
2509 } 2509 }
2510 2510
2511 WebInspector.DataGridNode.prototype.createCells.call(this); 2511 WebInspector.SortableDataGridNode.prototype.createCells.call(this);
2512 2512
2513 this.refreshGraph(this._parentView.calculator); 2513 this.refreshGraph(this._parentView.calculator);
2514 }, 2514 },
2515 2515
2516 /** 2516 /**
2517 * @override 2517 * @override
2518 * @param {string} columnIdentifier 2518 * @param {string} columnIdentifier
2519 * @return {!Element} 2519 * @return {!Element}
2520 */ 2520 */
2521 createCell: function(columnIdentifier) 2521 createCell: function(columnIdentifier)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2563 2563
2564 _onClick: function() 2564 _onClick: function()
2565 { 2565 {
2566 if (!this._parentView._allowRequestSelection) 2566 if (!this._parentView._allowRequestSelection)
2567 this.select(); 2567 this.select();
2568 }, 2568 },
2569 2569
2570 select: function() 2570 select: function()
2571 { 2571 {
2572 this._parentView.dispatchEventToListeners(WebInspector.NetworkLogView.Ev entTypes.RequestSelected, this._request); 2572 this._parentView.dispatchEventToListeners(WebInspector.NetworkLogView.Ev entTypes.RequestSelected, this._request);
2573 WebInspector.DataGridNode.prototype.select.apply(this, arguments); 2573 WebInspector.SortableDataGridNode.prototype.select.apply(this, arguments );
2574 2574
2575 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet rics.UserAction, { 2575 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet rics.UserAction, {
2576 action: WebInspector.UserMetrics.UserActionNames.NetworkRequestSelec ted, 2576 action: WebInspector.UserMetrics.UserActionNames.NetworkRequestSelec ted,
2577 url: this._request.url 2577 url: this._request.url
2578 }); 2578 });
2579 }, 2579 },
2580 2580
2581 /** 2581 /**
2582 * @param {!RegExp=} regexp 2582 * @param {!RegExp=} regexp
2583 */ 2583 */
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
2890 if (rightHidden) 2890 if (rightHidden)
2891 this._labelRightElement.classList.add("hidden"); 2891 this._labelRightElement.classList.add("hidden");
2892 this._labelRightElement.style.setProperty("left", this._percentages. end + "%"); 2892 this._labelRightElement.style.setProperty("left", this._percentages. end + "%");
2893 this._labelRightElement.classList.add("after"); 2893 this._labelRightElement.classList.add("after");
2894 } else { 2894 } else {
2895 this._labelRightElement.style.setProperty("left", this._percentages. middle + "%"); 2895 this._labelRightElement.style.setProperty("left", this._percentages. middle + "%");
2896 this._labelRightElement.style.setProperty("right", (100 - this._perc entages.end) + "%"); 2896 this._labelRightElement.style.setProperty("right", (100 - this._perc entages.end) + "%");
2897 } 2897 }
2898 }, 2898 },
2899 2899
2900 __proto__: WebInspector.DataGridNode.prototype 2900 __proto__: WebInspector.SortableDataGridNode.prototype
2901 } 2901 }
2902 2902
2903 /** 2903 /**
2904 * @param {!WebInspector.NetworkDataGridNode} a 2904 * @param {!WebInspector.NetworkDataGridNode} a
2905 * @param {!WebInspector.NetworkDataGridNode} b 2905 * @param {!WebInspector.NetworkDataGridNode} b
2906 * @return {number} 2906 * @return {number}
2907 */ 2907 */
2908 WebInspector.NetworkDataGridNode.NameComparator = function(a, b) 2908 WebInspector.NetworkDataGridNode.NameComparator = function(a, b)
2909 { 2909 {
2910 var aFileName = a._request.name(); 2910 var aFileName = a._request.name();
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3018 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) 3018 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b)
3019 { 3019 {
3020 var aValue = a._request[propertyName]; 3020 var aValue = a._request[propertyName];
3021 var bValue = b._request[propertyName]; 3021 var bValue = b._request[propertyName];
3022 if (aValue > bValue) 3022 if (aValue > bValue)
3023 return revert ? -1 : 1; 3023 return revert ? -1 : 1;
3024 if (bValue > aValue) 3024 if (bValue > aValue)
3025 return revert ? 1 : -1; 3025 return revert ? 1 : -1;
3026 return a._request.indentityCompare(b._request); 3026 return a._request.indentityCompare(b._request);
3027 } 3027 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/inspector.html ('k') | Source/devtools/front_end/resources/DatabaseQueryView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698