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.FilterBar} filterBar |
45 * @param {WebInspector.Setting} coulmnsVisibilitySetting | 46 * @param {WebInspector.Setting} coulmnsVisibilitySetting |
46 */ | 47 */ |
47 WebInspector.NetworkLogView = function(coulmnsVisibilitySetting) | 48 WebInspector.NetworkLogView = function(filterBar, coulmnsVisibilitySetting) |
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._filterBar = filterBar; |
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._textFilterUI = new WebInspector.TextFilterUI(); |
| 104 this._textFilterUI.addEventListener(WebInspector.FilterUI.Events.FilterC
hanged, this._filterChanged, this); |
| 105 this._filterBar.addFilter(this._textFilterUI); |
| 106 |
| 107 this._resourceTypeFilterUI = new WebInspector.NamedBitSetFilterUI(); |
| 108 for (var typeId in WebInspector.resourceTypes) { |
| 109 var resourceType = WebInspector.resourceTypes[typeId]; |
| 110 this._resourceTypeFilterUI.addBit(resourceType.name(), resourceType.
categoryTitle()); |
| 111 } |
| 112 this._resourceTypeFilterUI.addEventListener(WebInspector.FilterUI.Events
.FilterChanged, this._filterChanged.bind(this), this); |
| 113 this._filterBar.addFilter(this._resourceTypeFilterUI); |
| 114 }, |
| 115 |
| 116 _filterChanged: function(event) |
| 117 { |
| 118 this._removeAllNodeHighlights(); |
| 119 this.searchCanceled(); |
| 120 this._filterRequests(); |
| 121 }, |
| 122 |
99 _initializeView: function() | 123 _initializeView: function() |
100 { | 124 { |
101 this.element.id = "network-container"; | 125 this.element.id = "network-container"; |
102 | 126 |
103 this._createSortingFunctions(); | 127 this._createSortingFunctions(); |
104 this._createTable(); | 128 this._createTable(); |
105 this._createTimelineGrid(); | 129 this._createTimelineGrid(); |
106 this._summaryBarElement = this.element.createChild("div", "network-summa
ry-bar"); | 130 this._summaryBarElement = this.element.createChild("div", "network-summa
ry-bar"); |
107 | 131 |
108 if (!this.useLargeRows) | 132 if (!this.useLargeRows) |
109 this._setLargerRequests(this.useLargeRows); | 133 this._setLargerRequests(this.useLargeRows); |
110 | 134 |
111 this._allowPopover = true; | 135 this._allowPopover = true; |
112 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this.
_getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover.
bind(this)); | 136 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this.
_getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover.
bind(this)); |
113 // Enable faster hint. | 137 // Enable faster hint. |
114 this._popoverHelper.setTimeout(100); | 138 this._popoverHelper.setTimeout(100); |
115 | 139 |
116 this.calculator = new WebInspector.NetworkTransferTimeCalculator(); | 140 this.calculator = new WebInspector.NetworkTransferTimeCalculator(); |
117 this._toggleTypeFilter(WebInspector.NetworkLogView.ALL_TYPES, false); | |
118 | 141 |
119 this.switchToDetailedView(); | 142 this.switchToDetailedView(); |
120 }, | 143 }, |
121 | 144 |
122 get statusBarItems() | 145 get statusBarItems() |
123 { | 146 { |
124 return [this._preserveLogToggle.element, this._clearButton.element, this
._filterBarElement, this._largerRequestsButton.element, this._progressBarContain
er]; | 147 return [this._preserveLogToggle.element, this._filterBar.filterButton(),
this._clearButton.element, this._largerRequestsButton.element, this._progressBa
rContainer]; |
125 }, | 148 }, |
126 | 149 |
127 get useLargeRows() | 150 get useLargeRows() |
128 { | 151 { |
129 return WebInspector.settings.resourcesLargeRows.get(); | 152 return WebInspector.settings.resourcesLargeRows.get(); |
130 }, | 153 }, |
131 | 154 |
132 set allowPopover(flag) | 155 set allowPopover(flag) |
133 { | 156 { |
134 this._allowPopover = flag; | 157 this._allowPopover = flag; |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 this._dataGrid.sortNodes(sortingFunction); | 424 this._dataGrid.sortNodes(sortingFunction); |
402 this.calculator = this._calculators[value]; | 425 this.calculator = this._calculators[value]; |
403 if (this.calculator.startAtZero) | 426 if (this.calculator.startAtZero) |
404 this._timelineGrid.hideEventDividers(); | 427 this._timelineGrid.hideEventDividers(); |
405 else | 428 else |
406 this._timelineGrid.showEventDividers(); | 429 this._timelineGrid.showEventDividers(); |
407 this._dataGrid.markColumnAsSortedBy("timeline", WebInspector.DataGrid.Or
der.Ascending); | 430 this._dataGrid.markColumnAsSortedBy("timeline", WebInspector.DataGrid.Or
der.Ascending); |
408 this._updateOffscreenRows(); | 431 this._updateOffscreenRows(); |
409 }, | 432 }, |
410 | 433 |
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() | 434 _createStatusBarItems: function() |
425 { | 435 { |
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"); | 436 this._progressBarContainer = document.createElement("div"); |
440 this._progressBarContainer.className = "status-bar-item"; | 437 this._progressBarContainer.className = "status-bar-item"; |
441 }, | 438 }, |
442 | 439 |
443 _updateSummaryBar: function() | 440 _updateSummaryBar: function() |
444 { | 441 { |
445 var requestsNumber = this._requests.length; | 442 var requestsNumber = this._requests.length; |
446 | 443 |
447 if (!requestsNumber) { | 444 if (!requestsNumber) { |
448 if (this._summaryBarElement._isDisplayingWarning) | 445 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) { | 483 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)"), | 484 text += " \u2758 " + String.sprintf(WebInspector.UIString("%s (loa
d: %s, DOMContentLoaded: %s)"), |
488 Number.secondsToString(maxTime - baseTime), | 485 Number.secondsToString(maxTime - baseTime), |
489 Number.secondsToString(this._mainRequestLoadTime - baseT
ime), | 486 Number.secondsToString(this._mainRequestLoadTime - baseT
ime), |
490 Number.secondsToString(this._mainRequestDOMContentLoaded
Time - baseTime)); | 487 Number.secondsToString(this._mainRequestDOMContentLoaded
Time - baseTime)); |
491 } | 488 } |
492 this._summaryBarElement.textContent = text; | 489 this._summaryBarElement.textContent = text; |
493 this._summaryBarElement.title = text; | 490 this._summaryBarElement.title = text; |
494 }, | 491 }, |
495 | 492 |
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() | 493 _scheduleRefresh: function() |
543 { | 494 { |
544 if (this._needsRefresh) | 495 if (this._needsRefresh) |
545 return; | 496 return; |
546 | 497 |
547 this._needsRefresh = true; | 498 this._needsRefresh = true; |
548 | 499 |
549 if (this.isShowing() && !this._refreshTimeout) | 500 if (this.isShowing() && !this._refreshTimeout) |
550 this._refreshTimeout = setTimeout(this.refresh.bind(this), WebInspec
tor.NetworkLogView._defaultRefreshDelay); | 501 this._refreshTimeout = setTimeout(this.refresh.bind(this), WebInspec
tor.NetworkLogView._defaultRefreshDelay); |
551 }, | 502 }, |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea
rchCountUpdated, this._matchedRequests.length); | 1226 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea
rchCountUpdated, this._matchedRequests.length); |
1276 if (shouldJump) | 1227 if (shouldJump) |
1277 this._highlightNthMatchedRequestForSearch(newMatchedRequestIndex, tr
ue); | 1228 this._highlightNthMatchedRequestForSearch(newMatchedRequestIndex, tr
ue); |
1278 }, | 1229 }, |
1279 | 1230 |
1280 /** | 1231 /** |
1281 * @param {!WebInspector.NetworkDataGridNode} node | 1232 * @param {!WebInspector.NetworkDataGridNode} node |
1282 */ | 1233 */ |
1283 _applyFilter: function(node) | 1234 _applyFilter: function(node) |
1284 { | 1235 { |
1285 var filter = this._filterRegExp; | 1236 var filter = this._textFilterUI.regex(); |
1286 var request = node._request; | 1237 var request = node._request; |
1287 var matches = false; | 1238 var matches = false; |
1288 if (this._typeFilter(request)) { | 1239 if (this._resourceTypeFilterUI.accept(request.type.name())) { |
1289 matches = !filter || filter.test(request.name()) || filter.test(requ
est.path()); | 1240 matches = !filter || filter.test(request.name()) || filter.test(requ
est.path()); |
1290 if (filter && matches) | 1241 if (filter && matches) |
1291 this._highlightMatchedRequest(request, false, filter); | 1242 this._highlightMatchedRequest(request, false, filter); |
1292 } | 1243 } |
1293 node.element.enableStyleClass("filtered-out", !matches); | 1244 node.element.enableStyleClass("filtered-out", !matches); |
1294 if (matches) | 1245 if (matches) |
1295 this._filteredOutRequests.remove(request); | 1246 this._filteredOutRequests.remove(request); |
1296 else | 1247 else |
1297 this._filteredOutRequests.put(request, true); | 1248 this._filteredOutRequests.put(request, true); |
1298 }, | 1249 }, |
1299 | 1250 |
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() | 1251 _filterRequests: function() |
1312 { | 1252 { |
1313 this._removeAllHighlights(); | 1253 this._removeAllHighlights(); |
1314 this._filteredOutRequests.clear(); | 1254 this._filteredOutRequests.clear(); |
1315 | 1255 |
1316 var nodes = this._dataGrid.rootNode().children; | 1256 var nodes = this._dataGrid.rootNode().children; |
1317 for (var i = 0; i < nodes.length; ++i) | 1257 for (var i = 0; i < nodes.length; ++i) |
1318 this._applyFilter(nodes[i]); | 1258 this._applyFilter(nodes[i]); |
1319 this._updateSummaryBar(); | 1259 this._updateSummaryBar(); |
1320 this._updateOffscreenRows(); | 1260 this._updateOffscreenRows(); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 * @constructor | 1426 * @constructor |
1487 * @extends {WebInspector.Panel} | 1427 * @extends {WebInspector.Panel} |
1488 * @implements {WebInspector.ContextMenu.Provider} | 1428 * @implements {WebInspector.ContextMenu.Provider} |
1489 */ | 1429 */ |
1490 WebInspector.NetworkPanel = function() | 1430 WebInspector.NetworkPanel = function() |
1491 { | 1431 { |
1492 WebInspector.Panel.call(this, "network"); | 1432 WebInspector.Panel.call(this, "network"); |
1493 this.registerRequiredCSS("networkPanel.css"); | 1433 this.registerRequiredCSS("networkPanel.css"); |
1494 this._injectStyles(); | 1434 this._injectStyles(); |
1495 | 1435 |
| 1436 this._filterBar = new WebInspector.FilterBar(); |
| 1437 this._filtersContainer = this.element.createChild("div", "network-filters-he
ader hidden"); |
| 1438 this._filtersContainer.appendChild(this._filterBar.filtersElement()); |
| 1439 this._filterBar.addEventListener(WebInspector.FilterBar.Events.FiltersToggle
d, this._onFiltersToggled, this); |
| 1440 |
| 1441 this.element.addStyleClass("vbox"); |
1496 this.createSidebarView(); | 1442 this.createSidebarView(); |
| 1443 this.splitView.element.removeStyleClass("fill"); |
1497 this.splitView.hideMainElement(); | 1444 this.splitView.hideMainElement(); |
1498 | 1445 |
1499 var defaultColumnsVisibility = WebInspector.NetworkLogView._defaultColumnsVi
sibility; | 1446 var defaultColumnsVisibility = WebInspector.NetworkLogView._defaultColumnsVi
sibility; |
1500 var networkLogColumnsVisibilitySetting = WebInspector.settings.createSetting
("networkLogColumnsVisibility", defaultColumnsVisibility); | 1447 var networkLogColumnsVisibilitySetting = WebInspector.settings.createSetting
("networkLogColumnsVisibility", defaultColumnsVisibility); |
1501 var savedColumnsVisibility = networkLogColumnsVisibilitySetting.get(); | 1448 var savedColumnsVisibility = networkLogColumnsVisibilitySetting.get(); |
1502 var columnsVisibility = {}; | 1449 var columnsVisibility = {}; |
1503 for (var columnId in defaultColumnsVisibility) | 1450 for (var columnId in defaultColumnsVisibility) |
1504 columnsVisibility[columnId] = savedColumnsVisibility.hasOwnProperty(colu
mnId) ? savedColumnsVisibility[columnId] : defaultColumnsVisibility[columnId]; | 1451 columnsVisibility[columnId] = savedColumnsVisibility.hasOwnProperty(colu
mnId) ? savedColumnsVisibility[columnId] : defaultColumnsVisibility[columnId]; |
1505 networkLogColumnsVisibilitySetting.set(columnsVisibility); | 1452 networkLogColumnsVisibilitySetting.set(columnsVisibility); |
1506 | 1453 |
1507 this._networkLogView = new WebInspector.NetworkLogView(networkLogColumnsVisi
bilitySetting); | 1454 this._networkLogView = new WebInspector.NetworkLogView(this._filterBar, netw
orkLogColumnsVisibilitySetting); |
1508 this._networkLogView.show(this.sidebarElement); | 1455 this._networkLogView.show(this.sidebarElement); |
1509 | 1456 |
1510 this._viewsContainerElement = this.splitView.mainElement; | 1457 this._viewsContainerElement = this.splitView.mainElement; |
1511 this._viewsContainerElement.id = "network-views"; | 1458 this._viewsContainerElement.id = "network-views"; |
1512 this._viewsContainerElement.addStyleClass("hidden"); | 1459 this._viewsContainerElement.addStyleClass("hidden"); |
1513 if (!this._networkLogView.useLargeRows) | 1460 if (!this._networkLogView.useLargeRows) |
1514 this._viewsContainerElement.addStyleClass("small"); | 1461 this._viewsContainerElement.addStyleClass("small"); |
1515 | 1462 |
1516 this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes
.ViewCleared, this._onViewCleared, this); | 1463 this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes
.ViewCleared, this._onViewCleared, this); |
1517 this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes
.RowSizeChanged, this._onRowSizeChanged, this); | 1464 this._networkLogView.addEventListener(WebInspector.NetworkLogView.EventTypes
.RowSizeChanged, this._onRowSizeChanged, this); |
(...skipping 12 matching lines...) Expand all Loading... |
1530 } | 1477 } |
1531 WebInspector.GoToLineDialog.install(this, viewGetter.bind(this)); | 1478 WebInspector.GoToLineDialog.install(this, viewGetter.bind(this)); |
1532 } | 1479 } |
1533 | 1480 |
1534 WebInspector.NetworkPanel.prototype = { | 1481 WebInspector.NetworkPanel.prototype = { |
1535 get statusBarItems() | 1482 get statusBarItems() |
1536 { | 1483 { |
1537 return this._networkLogView.statusBarItems; | 1484 return this._networkLogView.statusBarItems; |
1538 }, | 1485 }, |
1539 | 1486 |
| 1487 _onFiltersToggled: function(event) |
| 1488 { |
| 1489 var toggled = /** @type {boolean} */ (event.data); |
| 1490 this._filtersContainer.enableStyleClass("hidden", !toggled); |
| 1491 this.element.enableStyleClass("filters-toggled", toggled); |
| 1492 }, |
| 1493 |
1540 elementsToRestoreScrollPositionsFor: function() | 1494 elementsToRestoreScrollPositionsFor: function() |
1541 { | 1495 { |
1542 return this._networkLogView.elementsToRestoreScrollPositionsFor(); | 1496 return this._networkLogView.elementsToRestoreScrollPositionsFor(); |
1543 }, | 1497 }, |
1544 | 1498 |
1545 // FIXME: only used by the layout tests, should not be exposed. | 1499 // FIXME: only used by the layout tests, should not be exposed. |
1546 _reset: function() | 1500 _reset: function() |
1547 { | 1501 { |
1548 this._networkLogView._reset(); | 1502 this._networkLogView._reset(); |
1549 }, | 1503 }, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 | 1634 |
1681 /** | 1635 /** |
1682 * @param {string} query | 1636 * @param {string} query |
1683 * @param {boolean} shouldJump | 1637 * @param {boolean} shouldJump |
1684 */ | 1638 */ |
1685 performSearch: function(query, shouldJump) | 1639 performSearch: function(query, shouldJump) |
1686 { | 1640 { |
1687 this._networkLogView.performSearch(query, shouldJump); | 1641 this._networkLogView.performSearch(query, shouldJump); |
1688 }, | 1642 }, |
1689 | 1643 |
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() | 1644 jumpToPreviousSearchResult: function() |
1707 { | 1645 { |
1708 this._networkLogView.jumpToPreviousSearchResult(); | 1646 this._networkLogView.jumpToPreviousSearchResult(); |
1709 }, | 1647 }, |
1710 | 1648 |
1711 jumpToNextSearchResult: function() | 1649 jumpToNextSearchResult: function() |
1712 { | 1650 { |
1713 this._networkLogView.jumpToNextSearchResult(); | 1651 this._networkLogView.jumpToNextSearchResult(); |
1714 }, | 1652 }, |
1715 | 1653 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 this._nameCell.addEventListener("dblclick", this._openInNewTab.bind(this
), false); | 2024 this._nameCell.addEventListener("dblclick", this._openInNewTab.bind(this
), false); |
2087 }, | 2025 }, |
2088 | 2026 |
2089 wasDetached: function() | 2027 wasDetached: function() |
2090 { | 2028 { |
2091 this._linkifier.reset(); | 2029 this._linkifier.reset(); |
2092 }, | 2030 }, |
2093 | 2031 |
2094 isFilteredOut: function() | 2032 isFilteredOut: function() |
2095 { | 2033 { |
2096 if (this._parentView._filteredOutRequests.get(this._request)) | 2034 return !!this._parentView._filteredOutRequests.get(this._request); |
2097 return true; | |
2098 return !this._parentView._typeFilter(this._request); | |
2099 }, | 2035 }, |
2100 | 2036 |
2101 _onClick: function() | 2037 _onClick: function() |
2102 { | 2038 { |
2103 if (!this._parentView._allowRequestSelection) | 2039 if (!this._parentView._allowRequestSelection) |
2104 this.select(); | 2040 this.select(); |
2105 }, | 2041 }, |
2106 | 2042 |
2107 select: function() | 2043 select: function() |
2108 { | 2044 { |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2477 this._labelRightElement.addStyleClass("after"); | 2413 this._labelRightElement.addStyleClass("after"); |
2478 } else { | 2414 } else { |
2479 this._labelRightElement.style.setProperty("left", this._percentages.
middle + "%"); | 2415 this._labelRightElement.style.setProperty("left", this._percentages.
middle + "%"); |
2480 this._labelRightElement.style.setProperty("right", (100 - this._perc
entages.end) + "%"); | 2416 this._labelRightElement.style.setProperty("right", (100 - this._perc
entages.end) + "%"); |
2481 } | 2417 } |
2482 }, | 2418 }, |
2483 | 2419 |
2484 __proto__: WebInspector.DataGridNode.prototype | 2420 __proto__: WebInspector.DataGridNode.prototype |
2485 } | 2421 } |
2486 | 2422 |
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) | 2423 WebInspector.NetworkDataGridNode.NameComparator = function(a, b) |
2508 { | 2424 { |
2509 var aFileName = a._request.name(); | 2425 var aFileName = a._request.name(); |
2510 var bFileName = b._request.name(); | 2426 var bFileName = b._request.name(); |
2511 if (aFileName > bFileName) | 2427 if (aFileName > bFileName) |
2512 return 1; | 2428 return 1; |
2513 if (bFileName > aFileName) | 2429 if (bFileName > aFileName) |
2514 return -1; | 2430 return -1; |
2515 return 0; | 2431 return 0; |
2516 } | 2432 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2570 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa
me, revert, a, b) | 2486 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa
me, revert, a, b) |
2571 { | 2487 { |
2572 var aValue = a._request[propertyName]; | 2488 var aValue = a._request[propertyName]; |
2573 var bValue = b._request[propertyName]; | 2489 var bValue = b._request[propertyName]; |
2574 if (aValue > bValue) | 2490 if (aValue > bValue) |
2575 return revert ? -1 : 1; | 2491 return revert ? -1 : 1; |
2576 if (bValue > aValue) | 2492 if (bValue > aValue) |
2577 return revert ? 1 : -1; | 2493 return revert ? 1 : -1; |
2578 return 0; | 2494 return 0; |
2579 } | 2495 } |
OLD | NEW |