Index: Source/devtools/front_end/network/NetworkPanel.js |
diff --git a/Source/devtools/front_end/network/NetworkPanel.js b/Source/devtools/front_end/network/NetworkPanel.js |
index dc9a58436164fb3ded2e5c854409f7f6d1998613..1907263f7f74a3704508aba6a293ea6b55ea0356 100644 |
--- a/Source/devtools/front_end/network/NetworkPanel.js |
+++ b/Source/devtools/front_end/network/NetworkPanel.js |
@@ -52,6 +52,11 @@ WebInspector.NetworkPanel = function() |
this._filterBar = new WebInspector.FilterBar("networkPanel", true); |
this.element.appendChild(this._filterBar.filtersElement()); |
+ if (Runtime.experiments.isEnabled("blockedURLs")) { |
+ this._blockedURLsBar = new WebInspector.BlockedURLsBar(); |
+ this.element.appendChild(this._blockedURLsBar.element); |
+ } |
+ |
this._searchableView = new WebInspector.SearchableView(this); |
this._searchableView.setPlaceholder(WebInspector.UIString("Find by filename or path")); |
this._searchableView.show(this.element); |
@@ -157,6 +162,8 @@ WebInspector.NetworkPanel.prototype = { |
this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox); |
this._panelToolbar.appendSeparator(); |
+ if (Runtime.experiments.isEnabled("blockedURLs")) |
+ this._panelToolbar.appendToolbarItem(this._blockedURLsBar.toolbarButton()); |
this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect()); |
this._panelToolbar.appendToolbarItem(new WebInspector.ToolbarItem(this._progressBarContainer)); |
}, |
@@ -738,3 +745,61 @@ WebInspector.NetworkPanel.FilmStripRecorder.prototype = { |
this._filmStripView.setStatusText(WebInspector.UIString("Fetching frames...")); |
} |
} |
+ |
+/** |
+ * @constructor |
+ */ |
+WebInspector.BlockedURLsBar = function() |
+{ |
+ this.element = createElementWithClass("div", "blocked-urls-bar"); |
+ |
+ this._toolbarButton = new WebInspector.ToolbarButton(WebInspector.UIString("Manage blocked URLs"), "filter-toolbar-item", 3); |
+ this._toolbarButton.addEventListener("click", this._toggleVisibility, this); |
+ |
+ this._manager = WebInspector.multitargetNetworkManager; |
+ this._manager.addEventListener(WebInspector.MultitargetNetworkManager.EventTypes.BlockedURLsChanged, this._update, this); |
+ |
+ this._visible = true; |
+ this._toggleVisibility(); |
+ this._update(); |
+} |
+ |
+WebInspector.BlockedURLsBar.prototype = { |
+ _updateToolbarButton: function() |
+ { |
+ this._toolbarButton.setState(this._visible ? "shown" : (this._manager.blockedURLs().size ? "active" : "inactive")); |
+ }, |
+ |
+ _update: function() |
+ { |
+ this._updateToolbarButton(); |
+ |
+ this.element.removeChildren(); |
+ for (var url of this._manager.blockedURLs()) { |
+ var container = this.element.createChild("div", "blocked-url-container"); |
+ var text = container.createChild("div", "blocked-url-text"); |
+ text.textContent = url; |
+ text.title = url; |
+ var closeButton = container.createChild("div", "close-button", "dt-close-button"); |
+ closeButton.addEventListener("click", this._manager.toggleURLBlocked.bind(this._manager, url), false); |
+ closeButton.gray = true; |
+ } |
+ if (!this._manager.blockedURLs().size) |
+ this.element.createChild("div", "blocked-urls-empty").textContent = WebInspector.UIString("No blocked URLs."); |
+ }, |
+ |
+ _toggleVisibility: function() |
+ { |
+ this._visible = !this._visible; |
+ this.element.classList.toggle("hidden", !this._visible); |
+ this._updateToolbarButton(); |
+ }, |
+ |
+ /** |
+ * @return {!WebInspector.ToolbarButton} |
+ */ |
+ toolbarButton: function() |
+ { |
+ return this._toolbarButton; |
+ } |
+} |