Chromium Code Reviews| 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 if (Runtime.experiments.isEnabled("blockedURLs")) { | |
|
pfeldman
2015/08/28 17:15:49
Looks good enough to leave the experiment to me.
dgozman
2015/08/31 21:17:39
Done.
| |
| 87 this._blockedURLsPane = new WebInspector.BlockedURLsPane(); | |
| 88 this._filterBar.addFilter(this._blockedURLsPane.filterUI()); | |
| 89 this._filterBar.addEventListener(WebInspector.FilterBar.Events.Toggled, this._toggleBlockedURLsSidebarPane, this); | |
| 90 this._toggleBlockedURLsSidebarPane(); | |
| 91 } | |
| 92 | |
| 91 this._networkLogShowOverviewSetting.addChangeListener(this._toggleShowOvervi ew, this); | 93 this._networkLogShowOverviewSetting.addChangeListener(this._toggleShowOvervi ew, this); |
| 92 this._networkLogLargeRowsSetting.addChangeListener(this._toggleLargerRequest s, this); | 94 this._networkLogLargeRowsSetting.addChangeListener(this._toggleLargerRequest s, this); |
| 93 this._networkRecordFilmStripSetting.addChangeListener(this._toggleRecordFilm Strip, this); | 95 this._networkRecordFilmStripSetting.addChangeListener(this._toggleRecordFilm Strip, this); |
| 94 | 96 |
| 95 this._toggleRecordButton(true); | 97 this._toggleRecordButton(true); |
| 96 this._toggleShowOverview(); | 98 this._toggleShowOverview(); |
| 97 this._toggleLargerRequests(); | 99 this._toggleLargerRequests(); |
| 98 this._toggleRecordFilmStrip(); | 100 this._toggleRecordFilmStrip(); |
| 99 this._updateUI(); | 101 this._updateUI(); |
| 100 | 102 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 this._panelToolbar.appendSeparator(); | 157 this._panelToolbar.appendSeparator(); |
| 156 | 158 |
| 157 this._preserveLogCheckbox = new WebInspector.ToolbarCheckbox(WebInspecto r.UIString("Preserve log"), WebInspector.UIString("Do not clear log on page relo ad / navigation")); | 159 this._preserveLogCheckbox = new WebInspector.ToolbarCheckbox(WebInspecto r.UIString("Preserve log"), WebInspector.UIString("Do not clear log on page relo ad / navigation")); |
| 158 this._preserveLogCheckbox.inputElement.addEventListener("change", this._ onPreserveLogCheckboxChanged.bind(this), false); | 160 this._preserveLogCheckbox.inputElement.addEventListener("change", this._ onPreserveLogCheckboxChanged.bind(this), false); |
| 159 this._panelToolbar.appendToolbarItem(this._preserveLogCheckbox); | 161 this._panelToolbar.appendToolbarItem(this._preserveLogCheckbox); |
| 160 | 162 |
| 161 this._disableCacheCheckbox = new WebInspector.ToolbarCheckbox(WebInspect or.UIString("Disable cache"), WebInspector.UIString("Disable cache (while DevToo ls is open)"), WebInspector.moduleSetting("cacheDisabled")); | 163 this._disableCacheCheckbox = new WebInspector.ToolbarCheckbox(WebInspect or.UIString("Disable cache"), WebInspector.UIString("Disable cache (while DevToo ls is open)"), WebInspector.moduleSetting("cacheDisabled")); |
| 162 this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox); | 164 this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox); |
| 163 | 165 |
| 164 this._panelToolbar.appendSeparator(); | 166 this._panelToolbar.appendSeparator(); |
| 165 if (Runtime.experiments.isEnabled("blockedURLs")) | |
| 166 this._panelToolbar.appendToolbarItem(this._blockedURLsBar.toolbarBu tton()); | |
| 167 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect ()); | 167 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect ()); |
| 168 this._panelToolbar.appendToolbarItem(new WebInspector.ToolbarItem(this._ progressBarContainer)); | 168 this._panelToolbar.appendToolbarItem(new WebInspector.ToolbarItem(this._ progressBarContainer)); |
| 169 }, | 169 }, |
| 170 | 170 |
| 171 /** | 171 /** |
| 172 * @return {!WebInspector.ToolbarComboBox} | 172 * @return {!WebInspector.ToolbarComboBox} |
| 173 */ | 173 */ |
| 174 _createNetworkConditionsSelect: function() | 174 _createNetworkConditionsSelect: function() |
| 175 { | 175 { |
| 176 var toolbarItem = new WebInspector.ToolbarComboBox(null); | 176 var toolbarItem = new WebInspector.ToolbarComboBox(null); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 _onClearButtonClicked: function(event) | 239 _onClearButtonClicked: function(event) |
| 240 { | 240 { |
| 241 this._reset(); | 241 this._reset(); |
| 242 }, | 242 }, |
| 243 | 243 |
| 244 _reset: function() | 244 _reset: function() |
| 245 { | 245 { |
| 246 this._calculator.reset(); | 246 this._calculator.reset(); |
| 247 this._overviewPane.reset(); | 247 this._overviewPane.reset(); |
| 248 this._networkLogView.reset(); | 248 this._networkLogView.reset(); |
| 249 if (Runtime.experiments.isEnabled("blockedURLs")) | |
| 250 this._blockedURLsPane.reset(); | |
| 249 if (this._filmStripView) | 251 if (this._filmStripView) |
| 250 this._resetFilmStripView(); | 252 this._resetFilmStripView(); |
| 251 }, | 253 }, |
| 252 | 254 |
| 253 /** | 255 /** |
| 254 * @param {!WebInspector.Event} event | 256 * @param {!WebInspector.Event} event |
| 255 */ | 257 */ |
| 256 _willReloadPage: function(event) | 258 _willReloadPage: function(event) |
| 257 { | 259 { |
| 258 if (!this._preserveLogCheckbox.checked()) | 260 if (!this._preserveLogCheckbox.checked()) |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 279 _toggleShowOverview: function() | 281 _toggleShowOverview: function() |
| 280 { | 282 { |
| 281 var toggled = this._networkLogShowOverviewSetting.get(); | 283 var toggled = this._networkLogShowOverviewSetting.get(); |
| 282 if (toggled) | 284 if (toggled) |
| 283 this._overviewPane.show(this._searchableView.element, this._splitWid get.element); | 285 this._overviewPane.show(this._searchableView.element, this._splitWid get.element); |
| 284 else | 286 else |
| 285 this._overviewPane.detach(); | 287 this._overviewPane.detach(); |
| 286 this.doResize(); | 288 this.doResize(); |
| 287 }, | 289 }, |
| 288 | 290 |
| 291 _toggleBlockedURLsSidebarPane: function() | |
| 292 { | |
| 293 var toggled = this._filterBar.filtersToggled(); | |
| 294 if (toggled) | |
| 295 this._blockedURLsPane.show(this._searchableView.element); | |
| 296 else | |
| 297 this._blockedURLsPane.detach(); | |
| 298 this.doResize(); | |
| 299 }, | |
| 300 | |
| 289 _toggleRecordFilmStrip: function() | 301 _toggleRecordFilmStrip: function() |
| 290 { | 302 { |
| 291 var toggled = this._networkRecordFilmStripSetting.get(); | 303 var toggled = this._networkRecordFilmStripSetting.get(); |
| 292 if (toggled && !this._filmStripRecorder) { | 304 if (toggled && !this._filmStripRecorder) { |
| 293 this._filmStripView = new WebInspector.FilmStripView(); | 305 this._filmStripView = new WebInspector.FilmStripView(); |
| 294 this._filmStripView.setMode(WebInspector.FilmStripView.Modes.FrameBa sed); | 306 this._filmStripView.setMode(WebInspector.FilmStripView.Modes.FrameBa sed); |
| 295 this._filmStripView.element.classList.add("network-film-strip"); | 307 this._filmStripView.element.classList.add("network-film-strip"); |
| 296 this._filmStripRecorder = new WebInspector.NetworkPanel.FilmStripRec order(this._filmStripView); | 308 this._filmStripRecorder = new WebInspector.NetworkPanel.FilmStripRec order(this._filmStripView); |
| 297 this._filmStripView.show(this._searchableView.element, this._searcha bleView.element.firstElementChild); | 309 this._filmStripView.show(this._searchableView.element, this._searcha bleView.element.firstElementChild); |
| 298 this._filmStripView.addEventListener(WebInspector.FilmStripView.Even ts.FrameSelected, this._onFilmFrameSelected, this); | 310 this._filmStripView.addEventListener(WebInspector.FilmStripView.Even ts.FrameSelected, this._onFilmFrameSelected, this); |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 738 { | 750 { |
| 739 if (!this._target) | 751 if (!this._target) |
| 740 return; | 752 return; |
| 741 | 753 |
| 742 this._target.tracingManager.stop(); | 754 this._target.tracingManager.stop(); |
| 743 this._target = null; | 755 this._target = null; |
| 744 this._callback = callback; | 756 this._callback = callback; |
| 745 this._filmStripView.setStatusText(WebInspector.UIString("Fetching frames ...")); | 757 this._filmStripView.setStatusText(WebInspector.UIString("Fetching frames ...")); |
| 746 } | 758 } |
| 747 } | 759 } |
| 748 | |
| 749 /** | |
| 750 * @constructor | |
| 751 */ | |
| 752 WebInspector.BlockedURLsBar = function() | |
| 753 { | |
| 754 this.element = createElementWithClass("div", "blocked-urls-bar"); | |
| 755 | |
| 756 this._toolbarButton = new WebInspector.ToolbarButton(WebInspector.UIString(" Manage blocked URLs"), "filter-toolbar-item", 3); | |
| 757 this._toolbarButton.addEventListener("click", this._toggleVisibility, this); | |
| 758 | |
| 759 this._manager = WebInspector.multitargetNetworkManager; | |
| 760 this._manager.addEventListener(WebInspector.MultitargetNetworkManager.EventT ypes.BlockedURLsChanged, this._update, this); | |
| 761 | |
| 762 this._visible = true; | |
| 763 this._toggleVisibility(); | |
| 764 this._update(); | |
| 765 } | |
| 766 | |
| 767 WebInspector.BlockedURLsBar.prototype = { | |
| 768 _updateToolbarButton: function() | |
| 769 { | |
| 770 this._toolbarButton.setState(this._visible ? "shown" : (this._manager.bl ockedURLs().size ? "active" : "inactive")); | |
| 771 }, | |
| 772 | |
| 773 _update: function() | |
| 774 { | |
| 775 this._updateToolbarButton(); | |
| 776 | |
| 777 this.element.removeChildren(); | |
| 778 for (var url of this._manager.blockedURLs()) { | |
| 779 var container = this.element.createChild("div", "blocked-url-contain er"); | |
| 780 var text = container.createChild("div", "blocked-url-text"); | |
| 781 text.textContent = url; | |
| 782 text.title = url; | |
| 783 var closeButton = container.createChild("div", "close-button", "dt-c lose-button"); | |
| 784 closeButton.addEventListener("click", this._manager.toggleURLBlocked .bind(this._manager, url), false); | |
| 785 closeButton.gray = true; | |
| 786 } | |
| 787 if (!this._manager.blockedURLs().size) | |
| 788 this.element.createChild("div", "blocked-urls-empty").textContent = WebInspector.UIString("No blocked URLs."); | |
| 789 }, | |
| 790 | |
| 791 _toggleVisibility: function() | |
| 792 { | |
| 793 this._visible = !this._visible; | |
| 794 this.element.classList.toggle("hidden", !this._visible); | |
| 795 this._updateToolbarButton(); | |
| 796 }, | |
| 797 | |
| 798 /** | |
| 799 * @return {!WebInspector.ToolbarButton} | |
| 800 */ | |
| 801 toolbarButton: function() | |
| 802 { | |
| 803 return this._toolbarButton; | |
| 804 } | |
| 805 } | |
| OLD | NEW |