OLD | NEW |
---|---|
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 24 matching lines...) Expand all Loading... | |
35 importScript("RequestHTMLView.js"); | 35 importScript("RequestHTMLView.js"); |
36 importScript("RequestJSONView.js"); | 36 importScript("RequestJSONView.js"); |
37 importScript("RequestPreviewView.js"); | 37 importScript("RequestPreviewView.js"); |
38 importScript("RequestResponseView.js"); | 38 importScript("RequestResponseView.js"); |
39 importScript("RequestTimingView.js"); | 39 importScript("RequestTimingView.js"); |
40 importScript("ResourceWebSocketFrameView.js"); | 40 importScript("ResourceWebSocketFrameView.js"); |
41 | 41 |
42 /** | 42 /** |
43 * @constructor | 43 * @constructor |
44 * @extends {WebInspector.View} | 44 * @extends {WebInspector.View} |
45 * @param {WebInspector.FilterController} filterController | |
45 * @param {WebInspector.Setting} coulmnsVisibilitySetting | 46 * @param {WebInspector.Setting} coulmnsVisibilitySetting |
46 */ | 47 */ |
47 WebInspector.NetworkLogView = function(coulmnsVisibilitySetting) | 48 WebInspector.NetworkLogView = function(filterController, coulmnsVisibilitySettin g) |
48 { | 49 { |
49 WebInspector.View.call(this); | 50 WebInspector.View.call(this); |
50 this.element.classList.add("vbox", "fill"); | 51 this.element.classList.add("vbox", "fill"); |
51 this.registerRequiredCSS("networkLogView.css"); | 52 this.registerRequiredCSS("networkLogView.css"); |
53 this.registerRequiredCSS("filter.css"); | |
52 | 54 |
55 this._filterController = filterController; | |
53 this._coulmnsVisibilitySetting = coulmnsVisibilitySetting; | 56 this._coulmnsVisibilitySetting = coulmnsVisibilitySetting; |
54 this._allowRequestSelection = false; | 57 this._allowRequestSelection = false; |
55 this._requests = []; | 58 this._requests = []; |
56 this._requestsById = {}; | 59 this._requestsById = {}; |
57 this._requestsByURL = {}; | 60 this._requestsByURL = {}; |
58 this._staleRequests = {}; | 61 this._staleRequests = {}; |
59 this._requestGridNodes = {}; | 62 this._requestGridNodes = {}; |
60 this._lastRequestGridNodeId = 0; | 63 this._lastRequestGridNodeId = 0; |
61 this._mainRequestLoadTime = -1; | 64 this._mainRequestLoadTime = -1; |
62 this._mainRequestDOMContentLoadedTime = -1; | 65 this._mainRequestDOMContentLoadedTime = -1; |
63 this._typeFilterElements = {}; | |
64 this._typeFilter = WebInspector.NetworkLogView._trivialTypeFilter; | |
65 this._matchedRequests = []; | 66 this._matchedRequests = []; |
66 this._highlightedSubstringChanges = []; | 67 this._highlightedSubstringChanges = []; |
67 this._filteredOutRequests = new Map(); | 68 this._filteredOutRequests = new Map(); |
68 | 69 |
69 this._matchedRequestsMap = {}; | 70 this._matchedRequestsMap = {}; |
70 this._currentMatchedRequestIndex = -1; | 71 this._currentMatchedRequestIndex = -1; |
71 | 72 |
72 this._createStatusbarButtons(); | 73 this._createStatusbarButtons(); |
73 this._createStatusBarItems(); | 74 this._createStatusBarItems(); |
74 this._linkifier = new WebInspector.Linkifier(); | 75 this._linkifier = new WebInspector.Linkifier(); |
75 | 76 |
76 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve ntTypes.RequestStarted, this._onRequestStarted, this); | 77 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve ntTypes.RequestStarted, this._onRequestStarted, this); |
77 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve ntTypes.RequestUpdated, this._onRequestUpdated, this); | 78 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve ntTypes.RequestUpdated, this._onRequestUpdated, this); |
78 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve ntTypes.RequestFinished, this._onRequestUpdated, this); | 79 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve ntTypes.RequestFinished, this._onRequestUpdated, this); |
79 | 80 |
80 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this); | 81 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this); |
81 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.Load, this._loadEventFired, this); | 82 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.Load, this._loadEventFired, this); |
82 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.DOMContentLoaded, this._domContentLoadedEventFired, this); | 83 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod el.EventTypes.DOMContentLoaded, this._domContentLoadedEventFired, this); |
83 | 84 |
85 this._addFilters(); | |
84 this._initializeView(); | 86 this._initializeView(); |
85 | 87 |
86 WebInspector.networkLog.requests.forEach(this._appendRequest.bind(this)); | 88 WebInspector.networkLog.requests.forEach(this._appendRequest.bind(this)); |
87 } | 89 } |
88 | 90 |
89 WebInspector.NetworkLogView.HTTPSchemas = {"http": true, "https": true, "ws": tr ue, "wss": true}; | 91 WebInspector.NetworkLogView.HTTPSchemas = {"http": true, "https": true, "ws": tr ue, "wss": true}; |
90 WebInspector.NetworkLogView._responseHeaderColumns = ["Cache-Control", "Connecti on", "Content-Encoding", "Content-Length", "ETag", "Keep-Alive", "Last-Modified" , "Server", "Vary"]; | 92 WebInspector.NetworkLogView._responseHeaderColumns = ["Cache-Control", "Connecti on", "Content-Encoding", "Content-Length", "ETag", "Keep-Alive", "Last-Modified" , "Server", "Vary"]; |
91 WebInspector.NetworkLogView._defaultColumnsVisibility = { | 93 WebInspector.NetworkLogView._defaultColumnsVisibility = { |
92 method: true, status: true, scheme: false, domain: false, type: true, initia tor: true, cookies: false, setCookies: false, size: true, time: true, | 94 method: true, status: true, scheme: false, domain: false, type: true, initia tor: true, cookies: false, setCookies: false, size: true, time: true, |
93 "Cache-Control": false, "Connection": false, "Content-Encoding": false, "Con tent-Length": false, "ETag": false, "Keep-Alive": false, "Last-Modified": false, "Server": false, "Vary": false | 95 "Cache-Control": false, "Connection": false, "Content-Encoding": false, "Con tent-Length": false, "ETag": false, "Keep-Alive": false, "Last-Modified": false, "Server": false, "Vary": false |
94 }; | 96 }; |
95 WebInspector.NetworkLogView._defaultRefreshDelay = 500; | 97 WebInspector.NetworkLogView._defaultRefreshDelay = 500; |
96 WebInspector.NetworkLogView.ALL_TYPES = "all"; | 98 WebInspector.NetworkLogView.ALL_TYPES = "all"; |
97 | 99 |
98 WebInspector.NetworkLogView.prototype = { | 100 WebInspector.NetworkLogView.prototype = { |
101 _addFilters: function() | |
102 { | |
103 this._textFilter = new WebInspector.TextFilter(); | |
pfeldman
2013/10/22 15:15:01
TextFilterUI
| |
104 this._textFilter.addEventListener(WebInspector.Filter.Events.FilterChang ed, this._filterChanged, this); | |
105 this._filterController.addFilter(this._textFilter); | |
106 | |
107 var types = []; | |
108 for (var typeId in WebInspector.resourceTypes) { | |
109 var resourceType = WebInspector.resourceTypes[typeId]; | |
110 var type = {}; | |
111 type.name = resourceType.name(); | |
112 type.label = resourceType.categoryTitle(); | |
113 types.push(type); | |
114 } | |
115 this._typesFilter = new WebInspector.TypesFilter(types); | |
pfeldman
2013/10/22 15:15:01
_typesFilter.addBit(name, label);
| |
116 this._typesFilter.addEventListener(WebInspector.Filter.Events.FilterChan ged, this._filterChanged.bind(this), this); | |
117 this._filterController.addFilter(this._typesFilter); | |
118 }, | |
119 | |
120 _filterChanged: function(event) | |
121 { | |
122 this._removeAllNodeHighlights(); | |
123 this.searchCanceled(); | |
124 this._filterRequests(); | |
125 }, | |
126 | |
99 _initializeView: function() | 127 _initializeView: function() |
100 { | 128 { |
101 this.element.id = "network-container"; | 129 this.element.id = "network-container"; |
102 | 130 |
103 this._createSortingFunctions(); | 131 this._createSortingFunctions(); |
104 this._createTable(); | 132 this._createTable(); |
105 this._createTimelineGrid(); | 133 this._createTimelineGrid(); |
106 this._summaryBarElement = this.element.createChild("div", "network-summa ry-bar"); | 134 this._summaryBarElement = this.element.createChild("div", "network-summa ry-bar"); |
107 | 135 |
108 if (!this.useLargeRows) | 136 if (!this.useLargeRows) |
109 this._setLargerRequests(this.useLargeRows); | 137 this._setLargerRequests(this.useLargeRows); |
110 | 138 |
111 this._allowPopover = true; | 139 this._allowPopover = true; |
112 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this. _getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover. bind(this)); | 140 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this. _getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover. bind(this)); |
113 // Enable faster hint. | 141 // Enable faster hint. |
114 this._popoverHelper.setTimeout(100); | 142 this._popoverHelper.setTimeout(100); |
115 | 143 |
116 this.calculator = new WebInspector.NetworkTransferTimeCalculator(); | 144 this.calculator = new WebInspector.NetworkTransferTimeCalculator(); |
117 this._toggleTypeFilter(WebInspector.NetworkLogView.ALL_TYPES, false); | |
118 | 145 |
119 this.switchToDetailedView(); | 146 this.switchToDetailedView(); |
120 }, | 147 }, |
121 | 148 |
122 get statusBarItems() | 149 get statusBarItems() |
123 { | 150 { |
124 return [this._preserveLogToggle.element, this._clearButton.element, this ._filterBarElement, this._largerRequestsButton.element, this._progressBarContain er]; | 151 return [this._preserveLogToggle.element, this._filterController.filterBu tton(), this._clearButton.element, this._largerRequestsButton.element, this._pro gressBarContainer]; |
125 }, | 152 }, |
126 | 153 |
127 get useLargeRows() | 154 get useLargeRows() |
128 { | 155 { |
129 return WebInspector.settings.resourcesLargeRows.get(); | 156 return WebInspector.settings.resourcesLargeRows.get(); |
130 }, | 157 }, |
131 | 158 |
132 set allowPopover(flag) | 159 set allowPopover(flag) |
133 { | 160 { |
134 this._allowPopover = flag; | 161 this._allowPopover = flag; |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
401 this._dataGrid.sortNodes(sortingFunction); | 428 this._dataGrid.sortNodes(sortingFunction); |
402 this.calculator = this._calculators[value]; | 429 this.calculator = this._calculators[value]; |
403 if (this.calculator.startAtZero) | 430 if (this.calculator.startAtZero) |
404 this._timelineGrid.hideEventDividers(); | 431 this._timelineGrid.hideEventDividers(); |
405 else | 432 else |
406 this._timelineGrid.showEventDividers(); | 433 this._timelineGrid.showEventDividers(); |
407 this._dataGrid.markColumnAsSortedBy("timeline", WebInspector.DataGrid.Or der.Ascending); | 434 this._dataGrid.markColumnAsSortedBy("timeline", WebInspector.DataGrid.Or der.Ascending); |
408 this._updateOffscreenRows(); | 435 this._updateOffscreenRows(); |
409 }, | 436 }, |
410 | 437 |
411 /** | |
412 * @param {string} typeName | |
413 * @param {string} label | |
414 */ | |
415 _addTypeFilter: function(typeName, label) | |
416 { | |
417 var typeFilterElement = this._filterBarElement.createChild("li", typeNam e); | |
418 typeFilterElement.typeName = typeName; | |
419 typeFilterElement.createTextChild(label); | |
420 typeFilterElement.addEventListener("click", this._onTypeFilterClicked.bi nd(this), false); | |
421 this._typeFilterElements[typeName] = typeFilterElement; | |
422 }, | |
423 | |
424 _createStatusBarItems: function() | 438 _createStatusBarItems: function() |
425 { | 439 { |
426 var filterBarElement = document.createElement("div"); | |
427 filterBarElement.className = "scope-bar status-bar-item"; | |
428 filterBarElement.title = WebInspector.UIString("Use %s Click to select m ultiple types.", WebInspector.KeyboardShortcut.shortcutToString("", WebInspector .KeyboardShortcut.Modifiers.CtrlOrMeta)); | |
429 this._filterBarElement = filterBarElement; | |
430 | |
431 this._addTypeFilter(WebInspector.NetworkLogView.ALL_TYPES, WebInspector. UIString("All")); | |
432 filterBarElement.createChild("div", "scope-bar-divider"); | |
433 | |
434 for (var typeId in WebInspector.resourceTypes) { | |
435 var type = WebInspector.resourceTypes[typeId]; | |
436 this._addTypeFilter(type.name(), type.categoryTitle()); | |
437 } | |
438 | |
439 this._progressBarContainer = document.createElement("div"); | 440 this._progressBarContainer = document.createElement("div"); |
440 this._progressBarContainer.className = "status-bar-item"; | 441 this._progressBarContainer.className = "status-bar-item"; |
441 }, | 442 }, |
442 | 443 |
443 _updateSummaryBar: function() | 444 _updateSummaryBar: function() |
444 { | 445 { |
445 var requestsNumber = this._requests.length; | 446 var requestsNumber = this._requests.length; |
446 | 447 |
447 if (!requestsNumber) { | 448 if (!requestsNumber) { |
448 if (this._summaryBarElement._isDisplayingWarning) | 449 if (this._summaryBarElement._isDisplayingWarning) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
486 if (baseTime !== -1 && this._mainRequestLoadTime !== -1 && this._mainReq uestDOMContentLoadedTime !== -1 && this._mainRequestDOMContentLoadedTime > baseT ime) { | 487 if (baseTime !== -1 && this._mainRequestLoadTime !== -1 && this._mainReq uestDOMContentLoadedTime !== -1 && this._mainRequestDOMContentLoadedTime > baseT ime) { |
487 text += " \u2758 " + String.sprintf(WebInspector.UIString("%s (loa d: %s, DOMContentLoaded: %s)"), | 488 text += " \u2758 " + String.sprintf(WebInspector.UIString("%s (loa d: %s, DOMContentLoaded: %s)"), |
488 Number.secondsToString(maxTime - baseTime), | 489 Number.secondsToString(maxTime - baseTime), |
489 Number.secondsToString(this._mainRequestLoadTime - baseT ime), | 490 Number.secondsToString(this._mainRequestLoadTime - baseT ime), |
490 Number.secondsToString(this._mainRequestDOMContentLoaded Time - baseTime)); | 491 Number.secondsToString(this._mainRequestDOMContentLoaded Time - baseTime)); |
491 } | 492 } |
492 this._summaryBarElement.textContent = text; | 493 this._summaryBarElement.textContent = text; |
493 this._summaryBarElement.title = text; | 494 this._summaryBarElement.title = text; |
494 }, | 495 }, |
495 | 496 |
496 /** | |
497 * @param {!Event} e | |
498 */ | |
499 _onTypeFilterClicked: function(e) | |
500 { | |
501 var toggle; | |
502 if (WebInspector.isMac()) | |
503 toggle = e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey; | |
504 else | |
505 toggle = e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey; | |
506 | |
507 this._toggleTypeFilter(e.target.typeName, toggle); | |
508 | |
509 this._removeAllNodeHighlights(); | |
510 this.searchCanceled(); | |
511 this._filterRequests(); | |
512 }, | |
513 | |
514 /** | |
515 * @param {string} typeName | |
516 * @param {boolean} allowMultiSelect | |
517 */ | |
518 _toggleTypeFilter: function(typeName, allowMultiSelect) | |
519 { | |
520 if (allowMultiSelect && typeName !== WebInspector.NetworkLogView.ALL_TYP ES) | |
521 this._typeFilterElements[WebInspector.NetworkLogView.ALL_TYPES].remo veStyleClass("selected"); | |
522 else { | |
523 for (var key in this._typeFilterElements) | |
524 this._typeFilterElements[key].removeStyleClass("selected"); | |
525 } | |
526 | |
527 var filterElement = this._typeFilterElements[typeName]; | |
528 filterElement.enableStyleClass("selected", !filterElement.hasStyleClass( "selected")); | |
529 | |
530 var allowedTypes = {}; | |
531 for (var key in this._typeFilterElements) { | |
532 if (this._typeFilterElements[key].hasStyleClass("selected")) | |
533 allowedTypes[key] = true; | |
534 } | |
535 | |
536 if (typeName === WebInspector.NetworkLogView.ALL_TYPES) | |
537 this._typeFilter = WebInspector.NetworkLogView._trivialTypeFilter; | |
538 else | |
539 this._typeFilter = WebInspector.NetworkLogView._typeFilter.bind(null , allowedTypes); | |
540 }, | |
541 | |
542 _scheduleRefresh: function() | 497 _scheduleRefresh: function() |
543 { | 498 { |
544 if (this._needsRefresh) | 499 if (this._needsRefresh) |
545 return; | 500 return; |
546 | 501 |
547 this._needsRefresh = true; | 502 this._needsRefresh = true; |
548 | 503 |
549 if (this.isShowing() && !this._refreshTimeout) | 504 if (this.isShowing() && !this._refreshTimeout) |
550 this._refreshTimeout = setTimeout(this.refresh.bind(this), WebInspec tor.NetworkLogView._defaultRefreshDelay); | 505 this._refreshTimeout = setTimeout(this.refresh.bind(this), WebInspec tor.NetworkLogView._defaultRefreshDelay); |
551 }, | 506 }, |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1275 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea rchCountUpdated, this._matchedRequests.length); | 1230 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea rchCountUpdated, this._matchedRequests.length); |
1276 if (shouldJump) | 1231 if (shouldJump) |
1277 this._highlightNthMatchedRequestForSearch(newMatchedRequestIndex, tr ue); | 1232 this._highlightNthMatchedRequestForSearch(newMatchedRequestIndex, tr ue); |
1278 }, | 1233 }, |
1279 | 1234 |
1280 /** | 1235 /** |
1281 * @param {!WebInspector.NetworkDataGridNode} node | 1236 * @param {!WebInspector.NetworkDataGridNode} node |
1282 */ | 1237 */ |
1283 _applyFilter: function(node) | 1238 _applyFilter: function(node) |
1284 { | 1239 { |
1285 var filter = this._filterRegExp; | 1240 var filter = this._textFilter.regex(); |
1286 var request = node._request; | 1241 var request = node._request; |
1287 var matches = false; | 1242 var matches = false; |
1288 if (this._typeFilter(request)) { | 1243 if (this._typesFilter.accept(request.type.name())) { |
1289 matches = !filter || filter.test(request.name()) || filter.test(requ est.path()); | 1244 matches = !filter || filter.test(request.name()) || filter.test(requ est.path()); |
1290 if (filter && matches) | 1245 if (filter && matches) |
1291 this._highlightMatchedRequest(request, false, filter); | 1246 this._highlightMatchedRequest(request, false, filter); |
1292 } | 1247 } |
1293 node.element.enableStyleClass("filtered-out", !matches); | 1248 node.element.enableStyleClass("filtered-out", !matches); |
1294 if (matches) | 1249 if (matches) |
1295 this._filteredOutRequests.remove(request); | 1250 this._filteredOutRequests.remove(request); |
1296 else | 1251 else |
1297 this._filteredOutRequests.put(request, true); | 1252 this._filteredOutRequests.put(request, true); |
1298 }, | 1253 }, |
1299 | 1254 |
1300 /** | |
1301 * @param {string} query | |
1302 */ | |
1303 performFilter: function(query) | |
1304 { | |
1305 delete this._filterRegExp; | |
1306 if (query) | |
1307 this._filterRegExp = createPlainTextSearchRegex(query, "i"); | |
1308 this._filterRequests(); | |
1309 }, | |
1310 | |
1311 _filterRequests: function() | 1255 _filterRequests: function() |
1312 { | 1256 { |
1313 this._removeAllHighlights(); | 1257 this._removeAllHighlights(); |
1314 this._filteredOutRequests.clear(); | 1258 this._filteredOutRequests.clear(); |
1315 | 1259 |
1316 var nodes = this._dataGrid.rootNode().children; | 1260 var nodes = this._dataGrid.rootNode().children; |
1317 for (var i = 0; i < nodes.length; ++i) | 1261 for (var i = 0; i < nodes.length; ++i) |
1318 this._applyFilter(nodes[i]); | 1262 this._applyFilter(nodes[i]); |
1319 this._updateSummaryBar(); | 1263 this._updateSummaryBar(); |
1320 this._updateOffscreenRows(); | 1264 this._updateOffscreenRows(); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1486 * @constructor | 1430 * @constructor |
1487 * @extends {WebInspector.Panel} | 1431 * @extends {WebInspector.Panel} |
1488 * @implements {WebInspector.ContextMenu.Provider} | 1432 * @implements {WebInspector.ContextMenu.Provider} |
1489 */ | 1433 */ |
1490 WebInspector.NetworkPanel = function() | 1434 WebInspector.NetworkPanel = function() |
1491 { | 1435 { |
1492 WebInspector.Panel.call(this, "network"); | 1436 WebInspector.Panel.call(this, "network"); |
1493 this.registerRequiredCSS("networkPanel.css"); | 1437 this.registerRequiredCSS("networkPanel.css"); |
1494 this._injectStyles(); | 1438 this._injectStyles(); |
1495 | 1439 |
1440 this._filterController = new WebInspector.FilterController(); | |
pfeldman
2013/10/22 15:15:01
FilterBar
| |
1441 this._filtersContainer = this.element.createChild("div", "network-filters-he ader hidden"); | |
1442 this._filtersContainer.appendChild(this._filterController.filtersElement()); | |
1443 this._filterController.addEventListener(WebInspector.FilterController.Events .FiltersToggled, this._onFiltersToggled, this); | |
1444 | |
1496 this.createSidebarView(); | 1445 this.createSidebarView(); |
1497 this.splitView.hideMainElement(); | 1446 this.splitView.hideMainElement(); |
1498 | 1447 |
1499 var defaultColumnsVisibility = WebInspector.NetworkLogView._defaultColumnsVi sibility; | 1448 var defaultColumnsVisibility = WebInspector.NetworkLogView._defaultColumnsVi sibility; |
1500 var networkLogColumnsVisibilitySetting = WebInspector.settings.createSetting ("networkLogColumnsVisibility", defaultColumnsVisibility); | 1449 var networkLogColumnsVisibilitySetting = WebInspector.settings.createSetting ("networkLogColumnsVisibility", defaultColumnsVisibility); |
1501 var savedColumnsVisibility = networkLogColumnsVisibilitySetting.get(); | 1450 var savedColumnsVisibility = networkLogColumnsVisibilitySetting.get(); |
1502 var columnsVisibility = {}; | 1451 var columnsVisibility = {}; |
1503 for (var columnId in defaultColumnsVisibility) | 1452 for (var columnId in defaultColumnsVisibility) |
1504 columnsVisibility[columnId] = savedColumnsVisibility.hasOwnProperty(colu mnId) ? savedColumnsVisibility[columnId] : defaultColumnsVisibility[columnId]; | 1453 columnsVisibility[columnId] = savedColumnsVisibility.hasOwnProperty(colu mnId) ? savedColumnsVisibility[columnId] : defaultColumnsVisibility[columnId]; |
1505 networkLogColumnsVisibilitySetting.set(columnsVisibility); | 1454 networkLogColumnsVisibilitySetting.set(columnsVisibility); |
1506 | 1455 |
1507 this._networkLogView = new WebInspector.NetworkLogView(networkLogColumnsVisi bilitySetting); | 1456 this._networkLogView = new WebInspector.NetworkLogView(this._filterControlle r, networkLogColumnsVisibilitySetting); |
1508 this._networkLogView.show(this.sidebarElement); | 1457 this._networkLogView.show(this.sidebarElement); |
1509 | 1458 |
1510 this._viewsContainerElement = this.splitView.mainElement; | 1459 this._viewsContainerElement = this.splitView.mainElement; |
1511 this._viewsContainerElement.id = "network-views"; | 1460 this._viewsContainerElement.id = "network-views"; |
1512 this._viewsContainerElement.addStyleClass("hidden"); | 1461 this._viewsContainerElement.addStyleClass("hidden"); |
1513 if (!this._networkLogView.useLargeRows) | 1462 if (!this._networkLogView.useLargeRows) |
1514 this._viewsContainerElement.addStyleClass("small"); | 1463 this._viewsContainerElement.addStyleClass("small"); |
1515 | 1464 |
1516 this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes .ViewCleared, this._onViewCleared, this); | 1465 this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes .ViewCleared, this._onViewCleared, this); |
1517 this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes .RowSizeChanged, this._onRowSizeChanged, this); | 1466 this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes .RowSizeChanged, this._onRowSizeChanged, this); |
(...skipping 12 matching lines...) Expand all Loading... | |
1530 } | 1479 } |
1531 WebInspector.GoToLineDialog.install(this, viewGetter.bind(this)); | 1480 WebInspector.GoToLineDialog.install(this, viewGetter.bind(this)); |
1532 } | 1481 } |
1533 | 1482 |
1534 WebInspector.NetworkPanel.prototype = { | 1483 WebInspector.NetworkPanel.prototype = { |
1535 get statusBarItems() | 1484 get statusBarItems() |
1536 { | 1485 { |
1537 return this._networkLogView.statusBarItems; | 1486 return this._networkLogView.statusBarItems; |
1538 }, | 1487 }, |
1539 | 1488 |
1489 _onFiltersToggled: function(event) | |
1490 { | |
1491 var toggled = /** @type {boolean} */ (event.data); | |
1492 this._filtersContainer.enableStyleClass("hidden", !toggled); | |
pfeldman
2013/10/22 15:15:01
Could we encapsulate it?
| |
1493 this.element.enableStyleClass("filters-toggled", toggled); | |
1494 }, | |
1495 | |
1540 elementsToRestoreScrollPositionsFor: function() | 1496 elementsToRestoreScrollPositionsFor: function() |
1541 { | 1497 { |
1542 return this._networkLogView.elementsToRestoreScrollPositionsFor(); | 1498 return this._networkLogView.elementsToRestoreScrollPositionsFor(); |
1543 }, | 1499 }, |
1544 | 1500 |
1545 // FIXME: only used by the layout tests, should not be exposed. | 1501 // FIXME: only used by the layout tests, should not be exposed. |
1546 _reset: function() | 1502 _reset: function() |
1547 { | 1503 { |
1548 this._networkLogView._reset(); | 1504 this._networkLogView._reset(); |
1549 }, | 1505 }, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1680 | 1636 |
1681 /** | 1637 /** |
1682 * @param {string} query | 1638 * @param {string} query |
1683 * @param {boolean} shouldJump | 1639 * @param {boolean} shouldJump |
1684 */ | 1640 */ |
1685 performSearch: function(query, shouldJump) | 1641 performSearch: function(query, shouldJump) |
1686 { | 1642 { |
1687 this._networkLogView.performSearch(query, shouldJump); | 1643 this._networkLogView.performSearch(query, shouldJump); |
1688 }, | 1644 }, |
1689 | 1645 |
1690 /** | |
1691 * @return {boolean} | |
1692 */ | |
1693 canFilter: function() | |
1694 { | |
1695 return true; | |
1696 }, | |
1697 | |
1698 /** | |
1699 * @param {string} query | |
1700 */ | |
1701 performFilter: function(query) | |
1702 { | |
1703 this._networkLogView.performFilter(query); | |
1704 }, | |
1705 | |
1706 jumpToPreviousSearchResult: function() | 1646 jumpToPreviousSearchResult: function() |
1707 { | 1647 { |
1708 this._networkLogView.jumpToPreviousSearchResult(); | 1648 this._networkLogView.jumpToPreviousSearchResult(); |
1709 }, | 1649 }, |
1710 | 1650 |
1711 jumpToNextSearchResult: function() | 1651 jumpToNextSearchResult: function() |
1712 { | 1652 { |
1713 this._networkLogView.jumpToNextSearchResult(); | 1653 this._networkLogView.jumpToNextSearchResult(); |
1714 }, | 1654 }, |
1715 | 1655 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2086 this._nameCell.addEventListener("dblclick", this._openInNewTab.bind(this ), false); | 2026 this._nameCell.addEventListener("dblclick", this._openInNewTab.bind(this ), false); |
2087 }, | 2027 }, |
2088 | 2028 |
2089 wasDetached: function() | 2029 wasDetached: function() |
2090 { | 2030 { |
2091 this._linkifier.reset(); | 2031 this._linkifier.reset(); |
2092 }, | 2032 }, |
2093 | 2033 |
2094 isFilteredOut: function() | 2034 isFilteredOut: function() |
2095 { | 2035 { |
2096 if (this._parentView._filteredOutRequests.get(this._request)) | 2036 return !!this._parentView._filteredOutRequests.get(this._request); |
2097 return true; | |
2098 return !this._parentView._typeFilter(this._request); | |
2099 }, | 2037 }, |
2100 | 2038 |
2101 _onClick: function() | 2039 _onClick: function() |
2102 { | 2040 { |
2103 if (!this._parentView._allowRequestSelection) | 2041 if (!this._parentView._allowRequestSelection) |
2104 this.select(); | 2042 this.select(); |
2105 }, | 2043 }, |
2106 | 2044 |
2107 select: function() | 2045 select: function() |
2108 { | 2046 { |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2477 this._labelRightElement.addStyleClass("after"); | 2415 this._labelRightElement.addStyleClass("after"); |
2478 } else { | 2416 } else { |
2479 this._labelRightElement.style.setProperty("left", this._percentages. middle + "%"); | 2417 this._labelRightElement.style.setProperty("left", this._percentages. middle + "%"); |
2480 this._labelRightElement.style.setProperty("right", (100 - this._perc entages.end) + "%"); | 2418 this._labelRightElement.style.setProperty("right", (100 - this._perc entages.end) + "%"); |
2481 } | 2419 } |
2482 }, | 2420 }, |
2483 | 2421 |
2484 __proto__: WebInspector.DataGridNode.prototype | 2422 __proto__: WebInspector.DataGridNode.prototype |
2485 } | 2423 } |
2486 | 2424 |
2487 /** | |
2488 * @param {WebInspector.NetworkRequest} request | |
2489 * @return {boolean} | |
2490 */ | |
2491 WebInspector.NetworkLogView._trivialTypeFilter = function(request) | |
2492 { | |
2493 return true; | |
2494 } | |
2495 | |
2496 /** | |
2497 * @param {!Object.<string, boolean>} allowedTypes | |
2498 * @param {WebInspector.NetworkRequest} request | |
2499 * @return {boolean} | |
2500 */ | |
2501 WebInspector.NetworkLogView._typeFilter = function(allowedTypes, request) | |
2502 { | |
2503 return request.type.name() in allowedTypes; | |
2504 } | |
2505 | |
2506 | |
2507 WebInspector.NetworkDataGridNode.NameComparator = function(a, b) | 2425 WebInspector.NetworkDataGridNode.NameComparator = function(a, b) |
2508 { | 2426 { |
2509 var aFileName = a._request.name(); | 2427 var aFileName = a._request.name(); |
2510 var bFileName = b._request.name(); | 2428 var bFileName = b._request.name(); |
2511 if (aFileName > bFileName) | 2429 if (aFileName > bFileName) |
2512 return 1; | 2430 return 1; |
2513 if (bFileName > aFileName) | 2431 if (bFileName > aFileName) |
2514 return -1; | 2432 return -1; |
2515 return 0; | 2433 return 0; |
2516 } | 2434 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2570 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) | 2488 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) |
2571 { | 2489 { |
2572 var aValue = a._request[propertyName]; | 2490 var aValue = a._request[propertyName]; |
2573 var bValue = b._request[propertyName]; | 2491 var bValue = b._request[propertyName]; |
2574 if (aValue > bValue) | 2492 if (aValue > bValue) |
2575 return revert ? -1 : 1; | 2493 return revert ? -1 : 1; |
2576 if (bValue > aValue) | 2494 if (bValue > aValue) |
2577 return revert ? 1 : -1; | 2495 return revert ? 1 : -1; |
2578 return 0; | 2496 return 0; |
2579 } | 2497 } |
OLD | NEW |