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

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

Issue 2447933002: [Devtools] Restructured contextMenu for DataGrid. (Closed)
Patch Set: changes Created 4 years, 1 month 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 elementsToRestoreScrollPositionsFor: function() 380 elementsToRestoreScrollPositionsFor: function()
381 { 381 {
382 if (!this._dataGrid) // Not initialized yet. 382 if (!this._dataGrid) // Not initialized yet.
383 return []; 383 return [];
384 return [this._dataGrid.scrollContainer]; 384 return [this._dataGrid.scrollContainer];
385 }, 385 },
386 386
387 _createTable: function() 387 _createTable: function()
388 { 388 {
389 this._dataGrid = this._columns.createGrid(this._timeCalculator, this._du rationCalculator); 389 this._dataGrid = this._columns.createGrid(this._timeCalculator, this._du rationCalculator);
390 this._dataGrid.setRowContextMenuCallback(this._onRowContextMenu.bind(thi s));
390 this._dataGrid.setStickToBottom(true); 391 this._dataGrid.setStickToBottom(true);
391 this._dataGrid.setName("networkLog"); 392 this._dataGrid.setName("networkLog");
392 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last); 393 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last);
393 this._dataGrid.element.classList.add("network-log-grid"); 394 this._dataGrid.element.classList.add("network-log-grid");
394 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true);
395 this._dataGrid.element.addEventListener("mousedown", this._dataGridMouse Down.bind(this), true); 395 this._dataGrid.element.addEventListener("mousedown", this._dataGridMouse Down.bind(this), true);
396 this._dataGrid.element.addEventListener("mousemove", this._dataGridMouse Move.bind(this), true); 396 this._dataGrid.element.addEventListener("mousemove", this._dataGridMouse Move.bind(this), true);
397 this._dataGrid.element.addEventListener("mouseleave", this._dataGridMous eLeave.bind(this), true); 397 this._dataGrid.element.addEventListener("mouseleave", this._dataGridMous eLeave.bind(this), true);
398 }, 398 },
399 399
400 /** 400 /**
401 * @param {!Event} event 401 * @param {!Event} event
402 */ 402 */
403 _dataGridMouseMove: function(event) 403 _dataGridMouseMove: function(event)
404 { 404 {
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 node.markAsNavigationRequest(); 906 node.markAsNavigationRequest();
907 break; 907 break;
908 } 908 }
909 } 909 }
910 }, 910 },
911 911
912 _createTimelineHeader: function() 912 _createTimelineHeader: function()
913 { 913 {
914 this._timelineHeaderElement = this._timelineWidget.element.createChild(" div", "network-timeline-header"); 914 this._timelineHeaderElement = this._timelineWidget.element.createChild(" div", "network-timeline-header");
915 this._timelineHeaderElement.addEventListener("click", timelineHeaderClic ked.bind(this)); 915 this._timelineHeaderElement.addEventListener("click", timelineHeaderClic ked.bind(this));
916 this._timelineHeaderElement.addEventListener("contextmenu", this._contex tMenu.bind(this)); 916 this._timelineHeaderElement.addEventListener("contextmenu", this._column s.headerContextMenuEvent.bind(this._columns));
917 var innerElement = this._timelineHeaderElement.createChild("div"); 917 var innerElement = this._timelineHeaderElement.createChild("div");
918 innerElement.textContent = WebInspector.UIString("Timeline"); 918 innerElement.textContent = WebInspector.UIString("Timeline");
919 this._timelineColumnSortIcon = this._timelineHeaderElement.createChild(" div", "sort-order-icon-container").createChild("div", "sort-order-icon"); 919 this._timelineColumnSortIcon = this._timelineHeaderElement.createChild(" div", "sort-order-icon-container").createChild("div", "sort-order-icon");
920 920
921 /** 921 /**
922 * @this {WebInspector.NetworkLogView} 922 * @this {WebInspector.NetworkLogView}
923 */ 923 */
924 function timelineHeaderClicked() 924 function timelineHeaderClicked()
925 { 925 {
926 var sortOrders = WebInspector.DataGrid.Order; 926 var sortOrders = WebInspector.DataGrid.Order;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 this._timelineColumn.setHeaderHeight(this._headerHeight); 970 this._timelineColumn.setHeaderHeight(this._headerHeight);
971 } 971 }
972 972
973 this._dataGrid.element.classList.toggle("small", !largeRows); 973 this._dataGrid.element.classList.toggle("small", !largeRows);
974 if (Runtime.experiments.isEnabled("canvasNetworkTimeline")) 974 if (Runtime.experiments.isEnabled("canvasNetworkTimeline"))
975 this._timelineHeaderElement.classList.toggle("small", !largeRows); 975 this._timelineHeaderElement.classList.toggle("small", !largeRows);
976 this._dataGrid.scheduleUpdate(); 976 this._dataGrid.scheduleUpdate();
977 }, 977 },
978 978
979 /** 979 /**
980 * @param {!Event} event 980 * @param {!WebInspector.ContextMenu} contextMenu
981 * @param {!WebInspector.DataGridNode} node
981 */ 982 */
982 _contextMenu: function(event) 983 _onRowContextMenu: function(contextMenu, node)
983 { 984 {
984 // TODO(allada) Fix datagrid's contextmenu so NetworkLogViewColumns can attach it's own contextmenu event 985 var request = node.request();
985 if (this._columns.contextMenu(event))
986 return;
987 var contextMenu = new WebInspector.ContextMenu(event);
988
989 var gridNode = this._dataGrid.dataGridNodeFromNode(event.target);
990 var request = gridNode && gridNode.request();
991
992 /**
993 * @param {string} url
994 */
995 function openResourceInNewTab(url)
996 {
997 InspectorFrontendHost.openInNewTab(url);
998 }
999 986
1000 contextMenu.appendApplicableItems(request); 987 contextMenu.appendApplicableItems(request);
1001 var copyMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Copy ")); 988 var copyMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Copy "));
1002 if (request) { 989 if (request) {
1003 copyMenu.appendItem(WebInspector.copyLinkAddressLabel(), InspectorFr ontendHost.copyText.bind(InspectorFrontendHost, request.contentURL())); 990 copyMenu.appendItem(WebInspector.copyLinkAddressLabel(), InspectorFr ontendHost.copyText.bind(InspectorFrontendHost, request.contentURL()));
1004 copyMenu.appendSeparator(); 991 copyMenu.appendSeparator();
1005 992
1006 if (request.requestHeadersText()) 993 if (request.requestHeadersText())
1007 copyMenu.appendItem(WebInspector.UIString.capitalize("Copy ^requ est ^headers"), this._copyRequestHeaders.bind(this, request)); 994 copyMenu.appendItem(WebInspector.UIString.capitalize("Copy ^requ est ^headers"), this._copyRequestHeaders.bind(this, request));
1008 if (request.responseHeadersText) 995 if (request.responseHeadersText)
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 * @return {boolean} 1882 * @return {boolean}
1896 */ 1883 */
1897 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request) 1884 WebInspector.NetworkLogView._requestTimeFilter = function(windowStart, windowEnd , request)
1898 { 1885 {
1899 if (request.issueTime() > windowEnd) 1886 if (request.issueTime() > windowEnd)
1900 return false; 1887 return false;
1901 if (request.endTime !== -1 && request.endTime < windowStart) 1888 if (request.endTime !== -1 && request.endTime < windowStart)
1902 return false; 1889 return false;
1903 return true; 1890 return true;
1904 }; 1891 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698