| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 /** @type {?WebInspector.FilmStripView} */ | 46 /** @type {?WebInspector.FilmStripView} */ |
| 47 this._filmStripView = null; | 47 this._filmStripView = null; |
| 48 /** @type {?WebInspector.NetworkPanel.FilmStripRecorder} */ | 48 /** @type {?WebInspector.NetworkPanel.FilmStripRecorder} */ |
| 49 this._filmStripRecorder = null; | 49 this._filmStripRecorder = null; |
| 50 | 50 |
| 51 this._panelToolbar = new WebInspector.Toolbar(this.element); | 51 this._panelToolbar = new WebInspector.Toolbar(this.element); |
| 52 this._filterBar = new WebInspector.FilterBar("networkPanel", true); | 52 this._filterBar = new WebInspector.FilterBar("networkPanel", true); |
| 53 this.element.appendChild(this._filterBar.filtersElement()); | 53 this.element.appendChild(this._filterBar.filtersElement()); |
| 54 | 54 |
| 55 if (Runtime.experiments.isEnabled("blockedURLs")) { | |
| 56 this._blockedURLsBar = new WebInspector.BlockedURLsBar(); | |
| 57 this.element.appendChild(this._blockedURLsBar.element); | |
| 58 } | |
| 59 | |
| 60 this._searchableView = new WebInspector.SearchableView(this); | 55 this._searchableView = new WebInspector.SearchableView(this); |
| 61 this._searchableView.setPlaceholder(WebInspector.UIString("Find by filename
or path")); | 56 this._searchableView.setPlaceholder(WebInspector.UIString("Find by filename
or path")); |
| 62 this._searchableView.show(this.element); | 57 this._searchableView.show(this.element); |
| 63 | 58 |
| 64 // Create top overview component. | 59 // Create top overview component. |
| 65 this._overviewPane = new WebInspector.TimelineOverviewPane("network"); | 60 this._overviewPane = new WebInspector.TimelineOverviewPane("network"); |
| 66 this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events
.WindowChanged, this._onWindowChanged.bind(this)); | 61 this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events
.WindowChanged, this._onWindowChanged.bind(this)); |
| 67 this._overviewPane.element.id = "network-overview-panel"; | 62 this._overviewPane.element.id = "network-overview-panel"; |
| 68 this._networkOverview = new WebInspector.NetworkOverview(); | 63 this._networkOverview = new WebInspector.NetworkOverview(); |
| 69 this._overviewPane.setOverviewControls([this._networkOverview]); | 64 this._overviewPane.setOverviewControls([this._networkOverview]); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 81 this._networkLogView = new WebInspector.NetworkLogView(this._filterBar, this
._progressBarContainer, this._networkLogLargeRowsSetting); | 76 this._networkLogView = new WebInspector.NetworkLogView(this._filterBar, this
._progressBarContainer, this._networkLogLargeRowsSetting); |
| 82 this._splitWidget.setSidebarWidget(this._networkLogView); | 77 this._splitWidget.setSidebarWidget(this._networkLogView); |
| 83 | 78 |
| 84 this._detailsWidget = new WebInspector.VBox(); | 79 this._detailsWidget = new WebInspector.VBox(); |
| 85 this._detailsWidget.element.classList.add("network-details-view"); | 80 this._detailsWidget.element.classList.add("network-details-view"); |
| 86 this._splitWidget.setMainWidget(this._detailsWidget); | 81 this._splitWidget.setMainWidget(this._detailsWidget); |
| 87 | 82 |
| 88 this._closeButtonElement = createElementWithClass("div", "network-close-butt
on", "dt-close-button"); | 83 this._closeButtonElement = createElementWithClass("div", "network-close-butt
on", "dt-close-button"); |
| 89 this._closeButtonElement.addEventListener("click", this._showRequest.bind(th
is, null), false); | 84 this._closeButtonElement.addEventListener("click", this._showRequest.bind(th
is, null), false); |
| 90 | 85 |
| 86 this._blockedURLsPane = new WebInspector.BlockedURLsPane(); |
| 87 this._blockedURLsPane.element.classList.add("network-blocked-urls"); |
| 88 this._filterBar.addFilter(this._blockedURLsPane.filterUI()); |
| 89 this._filterBar.addEventListener(WebInspector.FilterBar.Events.Toggled, this
._toggleBlockedURLsSidebarPane, this); |
| 90 this._toggleBlockedURLsSidebarPane(); |
| 91 |
| 91 this._networkLogShowOverviewSetting.addChangeListener(this._toggleShowOvervi
ew, this); | 92 this._networkLogShowOverviewSetting.addChangeListener(this._toggleShowOvervi
ew, this); |
| 92 this._networkLogLargeRowsSetting.addChangeListener(this._toggleLargerRequest
s, this); | 93 this._networkLogLargeRowsSetting.addChangeListener(this._toggleLargerRequest
s, this); |
| 93 this._networkRecordFilmStripSetting.addChangeListener(this._toggleRecordFilm
Strip, this); | 94 this._networkRecordFilmStripSetting.addChangeListener(this._toggleRecordFilm
Strip, this); |
| 94 | 95 |
| 95 this._toggleRecordButton(true); | 96 this._toggleRecordButton(true); |
| 96 this._toggleShowOverview(); | 97 this._toggleShowOverview(); |
| 97 this._toggleLargerRequests(); | 98 this._toggleLargerRequests(); |
| 98 this._toggleRecordFilmStrip(); | 99 this._toggleRecordFilmStrip(); |
| 99 this._updateUI(); | 100 this._updateUI(); |
| 100 | 101 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 this._panelToolbar.appendSeparator(); | 155 this._panelToolbar.appendSeparator(); |
| 155 | 156 |
| 156 this._preserveLogCheckbox = new WebInspector.ToolbarCheckbox(WebInspecto
r.UIString("Preserve log"), WebInspector.UIString("Do not clear log on page relo
ad / navigation")); | 157 this._preserveLogCheckbox = new WebInspector.ToolbarCheckbox(WebInspecto
r.UIString("Preserve log"), WebInspector.UIString("Do not clear log on page relo
ad / navigation")); |
| 157 this._preserveLogCheckbox.inputElement.addEventListener("change", this._
onPreserveLogCheckboxChanged.bind(this), false); | 158 this._preserveLogCheckbox.inputElement.addEventListener("change", this._
onPreserveLogCheckboxChanged.bind(this), false); |
| 158 this._panelToolbar.appendToolbarItem(this._preserveLogCheckbox); | 159 this._panelToolbar.appendToolbarItem(this._preserveLogCheckbox); |
| 159 | 160 |
| 160 this._disableCacheCheckbox = new WebInspector.ToolbarCheckbox(WebInspect
or.UIString("Disable cache"), WebInspector.UIString("Disable cache (while DevToo
ls is open)"), WebInspector.moduleSetting("cacheDisabled")); | 161 this._disableCacheCheckbox = new WebInspector.ToolbarCheckbox(WebInspect
or.UIString("Disable cache"), WebInspector.UIString("Disable cache (while DevToo
ls is open)"), WebInspector.moduleSetting("cacheDisabled")); |
| 161 this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox); | 162 this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox); |
| 162 | 163 |
| 163 this._panelToolbar.appendSeparator(); | 164 this._panelToolbar.appendSeparator(); |
| 164 if (Runtime.experiments.isEnabled("blockedURLs")) | |
| 165 this._panelToolbar.appendToolbarItem(this._blockedURLsBar.toolbarBu
tton()); | |
| 166 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect
()); | 165 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect
()); |
| 167 this._panelToolbar.appendToolbarItem(new WebInspector.ToolbarItem(this._
progressBarContainer)); | 166 this._panelToolbar.appendToolbarItem(new WebInspector.ToolbarItem(this._
progressBarContainer)); |
| 168 }, | 167 }, |
| 169 | 168 |
| 170 /** | 169 /** |
| 171 * @return {!WebInspector.ToolbarComboBox} | 170 * @return {!WebInspector.ToolbarComboBox} |
| 172 */ | 171 */ |
| 173 _createNetworkConditionsSelect: function() | 172 _createNetworkConditionsSelect: function() |
| 174 { | 173 { |
| 175 var toolbarItem = new WebInspector.ToolbarComboBox(null); | 174 var toolbarItem = new WebInspector.ToolbarComboBox(null); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 _onClearButtonClicked: function(event) | 234 _onClearButtonClicked: function(event) |
| 236 { | 235 { |
| 237 this._reset(); | 236 this._reset(); |
| 238 }, | 237 }, |
| 239 | 238 |
| 240 _reset: function() | 239 _reset: function() |
| 241 { | 240 { |
| 242 this._calculator.reset(); | 241 this._calculator.reset(); |
| 243 this._overviewPane.reset(); | 242 this._overviewPane.reset(); |
| 244 this._networkLogView.reset(); | 243 this._networkLogView.reset(); |
| 244 this._blockedURLsPane.reset(); |
| 245 if (this._filmStripView) | 245 if (this._filmStripView) |
| 246 this._resetFilmStripView(); | 246 this._resetFilmStripView(); |
| 247 }, | 247 }, |
| 248 | 248 |
| 249 /** | 249 /** |
| 250 * @param {!WebInspector.Event} event | 250 * @param {!WebInspector.Event} event |
| 251 */ | 251 */ |
| 252 _willReloadPage: function(event) | 252 _willReloadPage: function(event) |
| 253 { | 253 { |
| 254 if (!this._preserveLogCheckbox.checked()) | 254 if (!this._preserveLogCheckbox.checked()) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 275 _toggleShowOverview: function() | 275 _toggleShowOverview: function() |
| 276 { | 276 { |
| 277 var toggled = this._networkLogShowOverviewSetting.get(); | 277 var toggled = this._networkLogShowOverviewSetting.get(); |
| 278 if (toggled) | 278 if (toggled) |
| 279 this._overviewPane.show(this._searchableView.element, this._splitWid
get.element); | 279 this._overviewPane.show(this._searchableView.element, this._splitWid
get.element); |
| 280 else | 280 else |
| 281 this._overviewPane.detach(); | 281 this._overviewPane.detach(); |
| 282 this.doResize(); | 282 this.doResize(); |
| 283 }, | 283 }, |
| 284 | 284 |
| 285 _toggleBlockedURLsSidebarPane: function() |
| 286 { |
| 287 var toggled = this._filterBar.filtersToggled(); |
| 288 if (toggled) |
| 289 this._blockedURLsPane.show(this._searchableView.element); |
| 290 else |
| 291 this._blockedURLsPane.detach(); |
| 292 this.doResize(); |
| 293 }, |
| 294 |
| 285 _toggleRecordFilmStrip: function() | 295 _toggleRecordFilmStrip: function() |
| 286 { | 296 { |
| 287 var toggled = this._networkRecordFilmStripSetting.get(); | 297 var toggled = this._networkRecordFilmStripSetting.get(); |
| 288 if (toggled && !this._filmStripRecorder) { | 298 if (toggled && !this._filmStripRecorder) { |
| 289 this._filmStripView = new WebInspector.FilmStripView(); | 299 this._filmStripView = new WebInspector.FilmStripView(); |
| 290 this._filmStripView.setMode(WebInspector.FilmStripView.Modes.FrameBa
sed); | 300 this._filmStripView.setMode(WebInspector.FilmStripView.Modes.FrameBa
sed); |
| 291 this._filmStripView.element.classList.add("network-film-strip"); | 301 this._filmStripView.element.classList.add("network-film-strip"); |
| 292 this._filmStripRecorder = new WebInspector.NetworkPanel.FilmStripRec
order(this._filmStripView); | 302 this._filmStripRecorder = new WebInspector.NetworkPanel.FilmStripRec
order(this._filmStripView); |
| 293 this._filmStripView.show(this._searchableView.element, this._searcha
bleView.element.firstElementChild); | 303 this._filmStripView.show(this._searchableView.element, this._searcha
bleView.element.firstElementChild); |
| 294 this._filmStripView.addEventListener(WebInspector.FilmStripView.Even
ts.FrameSelected, this._onFilmFrameSelected, this); | 304 this._filmStripView.addEventListener(WebInspector.FilmStripView.Even
ts.FrameSelected, this._onFilmFrameSelected, this); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 | 752 |
| 743 this._target.tracingManager.stop(); | 753 this._target.tracingManager.stop(); |
| 744 this._target = null; | 754 this._target = null; |
| 745 this._callback = callback; | 755 this._callback = callback; |
| 746 this._filmStripView.setStatusText(WebInspector.UIString("Fetching frames
...")); | 756 this._filmStripView.setStatusText(WebInspector.UIString("Fetching frames
...")); |
| 747 } | 757 } |
| 748 } | 758 } |
| 749 | 759 |
| 750 /** | 760 /** |
| 751 * @constructor | 761 * @constructor |
| 752 */ | |
| 753 WebInspector.BlockedURLsBar = function() | |
| 754 { | |
| 755 this.element = createElementWithClass("div", "blocked-urls-bar"); | |
| 756 | |
| 757 this._toolbarButton = new WebInspector.ToolbarButton(WebInspector.UIString("
Manage blocked URLs"), "filter-toolbar-item", 3); | |
| 758 this._toolbarButton.addEventListener("click", this._toggleVisibility, this); | |
| 759 | |
| 760 this._manager = WebInspector.multitargetNetworkManager; | |
| 761 this._manager.addEventListener(WebInspector.MultitargetNetworkManager.EventT
ypes.BlockedURLsChanged, this._update, this); | |
| 762 | |
| 763 this._visible = true; | |
| 764 this._toggleVisibility(); | |
| 765 this._update(); | |
| 766 } | |
| 767 | |
| 768 WebInspector.BlockedURLsBar.prototype = { | |
| 769 _updateToolbarButton: function() | |
| 770 { | |
| 771 this._toolbarButton.setState(this._visible ? "shown" : (this._manager.bl
ockedURLs().size ? "active" : "inactive")); | |
| 772 }, | |
| 773 | |
| 774 _update: function() | |
| 775 { | |
| 776 this._updateToolbarButton(); | |
| 777 | |
| 778 this.element.removeChildren(); | |
| 779 for (var url of this._manager.blockedURLs()) { | |
| 780 var container = this.element.createChild("div", "blocked-url-contain
er"); | |
| 781 var text = container.createChild("div", "blocked-url-text"); | |
| 782 text.textContent = url; | |
| 783 text.title = url; | |
| 784 var closeButton = container.createChild("div", "close-button", "dt-c
lose-button"); | |
| 785 closeButton.addEventListener("click", this._manager.toggleURLBlocked
.bind(this._manager, url), false); | |
| 786 closeButton.gray = true; | |
| 787 } | |
| 788 if (!this._manager.blockedURLs().size) | |
| 789 this.element.createChild("div", "blocked-urls-empty").textContent =
WebInspector.UIString("No blocked URLs."); | |
| 790 }, | |
| 791 | |
| 792 _toggleVisibility: function() | |
| 793 { | |
| 794 this._visible = !this._visible; | |
| 795 this.element.classList.toggle("hidden", !this._visible); | |
| 796 this._updateToolbarButton(); | |
| 797 }, | |
| 798 | |
| 799 /** | |
| 800 * @return {!WebInspector.ToolbarButton} | |
| 801 */ | |
| 802 toolbarButton: function() | |
| 803 { | |
| 804 return this._toolbarButton; | |
| 805 } | |
| 806 } | |
| 807 | |
| 808 /** | |
| 809 * @constructor | |
| 810 * @implements {WebInspector.ActionDelegate} | 762 * @implements {WebInspector.ActionDelegate} |
| 811 */ | 763 */ |
| 812 WebInspector.NetworkPanel.RecordActionDelegate = function() | 764 WebInspector.NetworkPanel.RecordActionDelegate = function() |
| 813 { | 765 { |
| 814 } | 766 } |
| 815 WebInspector.NetworkPanel.RecordActionDelegate.prototype = { | 767 WebInspector.NetworkPanel.RecordActionDelegate.prototype = { |
| 816 /** | 768 /** |
| 817 * @override | 769 * @override |
| 818 * @param {!WebInspector.Context} context | 770 * @param {!WebInspector.Context} context |
| 819 * @param {string} actionId | 771 * @param {string} actionId |
| 820 */ | 772 */ |
| 821 handleAction: function(context, actionId) | 773 handleAction: function(context, actionId) |
| 822 { | 774 { |
| 823 var panel = WebInspector.context.flavor(WebInspector.NetworkPanel); | 775 var panel = WebInspector.context.flavor(WebInspector.NetworkPanel); |
| 824 console.assert(panel && panel instanceof WebInspector.NetworkPanel); | 776 console.assert(panel && panel instanceof WebInspector.NetworkPanel); |
| 825 panel._toggleRecording(); | 777 panel._toggleRecording(); |
| 826 } | 778 } |
| 827 } | 779 } |
| OLD | NEW |