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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 "Vary": WebInspector.UIString("Vary") | 177 "Vary": WebInspector.UIString("Vary") |
178 }; | 178 }; |
179 | 179 |
180 WebInspector.NetworkLogView.prototype = { | 180 WebInspector.NetworkLogView.prototype = { |
181 /** | 181 /** |
182 * @param {boolean} recording | 182 * @param {boolean} recording |
183 */ | 183 */ |
184 setRecording: function(recording) | 184 setRecording: function(recording) |
185 { | 185 { |
186 this._recording = recording; | 186 this._recording = recording; |
| 187 this._updateSummaryBar(); |
187 }, | 188 }, |
188 | 189 |
189 /** | 190 /** |
190 * @param {boolean} preserveLog | 191 * @param {boolean} preserveLog |
191 */ | 192 */ |
192 setPreserveLog: function(preserveLog) | 193 setPreserveLog: function(preserveLog) |
193 { | 194 { |
194 this._preserveLog = preserveLog; | 195 this._preserveLog = preserveLog; |
195 }, | 196 }, |
196 | 197 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 this._createTable(); | 285 this._createTable(); |
285 this._createTimelineGrid(); | 286 this._createTimelineGrid(); |
286 this._summaryBarElement = this.element.createChild("div", "network-summa
ry-bar"); | 287 this._summaryBarElement = this.element.createChild("div", "network-summa
ry-bar"); |
287 | 288 |
288 this._updateRowsSize(); | 289 this._updateRowsSize(); |
289 | 290 |
290 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this.
_getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover.
bind(this)); | 291 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this.
_getPopoverAnchor.bind(this), this._showPopover.bind(this), this._onHidePopover.
bind(this)); |
291 this.switchViewMode(true); | 292 this.switchViewMode(true); |
292 }, | 293 }, |
293 | 294 |
| 295 _showRecordingHint: function() |
| 296 { |
| 297 this._hideRecordingHint(); |
| 298 this._recordingHint = this.element.createChild("div", "network-status-pa
ne fill"); |
| 299 var hintText = this._recordingHint.createChild("div", "recording-hint"); |
| 300 var reloadShortcutNode = this._recordingHint.createChild("b"); |
| 301 reloadShortcutNode.textContent = WebInspector.ShortcutsScreen.TimelinePa
nelShortcuts.RecordPageReload[0].name; |
| 302 |
| 303 if (this._recording) { |
| 304 var recordingText = hintText.createChild("span"); |
| 305 recordingText.textContent = WebInspector.UIString("Recording network
activity\u2026"); |
| 306 hintText.createChild("br"); |
| 307 hintText.appendChild(WebInspector.formatLocalized(WebInspector.UIStr
ing("Perform a request or hit %s to record the reload."), [reloadShortcutNode],
null)); |
| 308 } else { |
| 309 var recordNode = hintText.createChild("b"); |
| 310 recordNode.textContent = WebInspector.shortcutRegistry.shortcutTitle
ForAction("network.toggle-recording"); |
| 311 hintText.appendChild(WebInspector.formatLocalized(WebInspector.UIStr
ing("Record (%s) or reload (%s) to display network activity."), [recordNode, rel
oadShortcutNode], null)); |
| 312 } |
| 313 }, |
| 314 |
| 315 _hideRecordingHint: function() |
| 316 { |
| 317 if (this._recordingHint) |
| 318 this._recordingHint.remove(); |
| 319 delete this._recordingHint; |
| 320 }, |
| 321 |
294 /** | 322 /** |
295 * @override | 323 * @override |
296 * @return {!Array.<!Element>} | 324 * @return {!Array.<!Element>} |
297 */ | 325 */ |
298 elementsToRestoreScrollPositionsFor: function() | 326 elementsToRestoreScrollPositionsFor: function() |
299 { | 327 { |
300 if (!this._dataGrid) // Not initialized yet. | 328 if (!this._dataGrid) // Not initialized yet. |
301 return []; | 329 return []; |
302 return [this._dataGrid.scrollContainer]; | 330 return [this._dataGrid.scrollContainer]; |
303 }, | 331 }, |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 this._dataGrid.sortNodes(sortingFunction); | 672 this._dataGrid.sortNodes(sortingFunction); |
645 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM
atchIndex(this._currentMatchedRequestNode), false); | 673 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM
atchIndex(this._currentMatchedRequestNode), false); |
646 this._dataGrid.markColumnAsSortedBy("timeline", selectedOption.sortOrder
); | 674 this._dataGrid.markColumnAsSortedBy("timeline", selectedOption.sortOrder
); |
647 }, | 675 }, |
648 | 676 |
649 _updateSummaryBar: function() | 677 _updateSummaryBar: function() |
650 { | 678 { |
651 var requestsNumber = this._nodesByRequestId.size; | 679 var requestsNumber = this._nodesByRequestId.size; |
652 | 680 |
653 if (!requestsNumber) { | 681 if (!requestsNumber) { |
654 if (this._summaryBarElement._isDisplayingWarning) | 682 this._showRecordingHint(); |
655 return; | |
656 this._summaryBarElement._isDisplayingWarning = true; | |
657 this._summaryBarElement.removeChildren(); | |
658 this._summaryBarElement.createChild("label", "", "dt-icon-label").ty
pe = "warning-icon"; | |
659 var text = WebInspector.UIString("No requests captured. Reload the p
age to see detailed information on the network activity."); | |
660 this._summaryBarElement.createTextChild(text); | |
661 this._summaryBarElement.title = text; | |
662 return; | 683 return; |
663 } | 684 } |
664 delete this._summaryBarElement._isDisplayingWarning; | 685 this._hideRecordingHint(); |
665 | 686 |
666 var transferSize = 0; | 687 var transferSize = 0; |
667 var selectedRequestsNumber = 0; | 688 var selectedRequestsNumber = 0; |
668 var selectedTransferSize = 0; | 689 var selectedTransferSize = 0; |
669 var baseTime = -1; | 690 var baseTime = -1; |
670 var maxTime = -1; | 691 var maxTime = -1; |
671 var nodes = this._nodesByRequestId.valuesArray(); | 692 var nodes = this._nodesByRequestId.valuesArray(); |
672 for (var i = 0; i < nodes.length; ++i) { | 693 for (var i = 0; i < nodes.length; ++i) { |
673 var request = nodes[i].request(); | 694 var request = nodes[i].request(); |
674 var requestTransferSize = request.transferSize; | 695 var requestTransferSize = request.transferSize; |
(...skipping 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2067 return false; | 2088 return false; |
2068 return true; | 2089 return true; |
2069 } | 2090 } |
2070 | 2091 |
2071 WebInspector.NetworkLogView.EventTypes = { | 2092 WebInspector.NetworkLogView.EventTypes = { |
2072 RequestSelected: "RequestSelected", | 2093 RequestSelected: "RequestSelected", |
2073 SearchCountUpdated: "SearchCountUpdated", | 2094 SearchCountUpdated: "SearchCountUpdated", |
2074 SearchIndexUpdated: "SearchIndexUpdated", | 2095 SearchIndexUpdated: "SearchIndexUpdated", |
2075 UpdateRequest: "UpdateRequest" | 2096 UpdateRequest: "UpdateRequest" |
2076 }; | 2097 }; |
OLD | NEW |