Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: Source/devtools/front_end/network/NetworkPanel.js

Issue 1295903005: [DevTools] Implementation of resource requests blocked by specific urls. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
55 this._searchableView = new WebInspector.SearchableView(this); 60 this._searchableView = new WebInspector.SearchableView(this);
56 this._searchableView.setPlaceholder(WebInspector.UIString("Find by filename or path")); 61 this._searchableView.setPlaceholder(WebInspector.UIString("Find by filename or path"));
57 this._searchableView.show(this.element); 62 this._searchableView.show(this.element);
58 63
59 // Create top overview component. 64 // Create top overview component.
60 this._overviewPane = new WebInspector.TimelineOverviewPane("network"); 65 this._overviewPane = new WebInspector.TimelineOverviewPane("network");
61 this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events .WindowChanged, this._onWindowChanged.bind(this)); 66 this._overviewPane.addEventListener(WebInspector.TimelineOverviewPane.Events .WindowChanged, this._onWindowChanged.bind(this));
62 this._overviewPane.element.id = "network-overview-panel"; 67 this._overviewPane.element.id = "network-overview-panel";
63 this._networkOverview = new WebInspector.NetworkOverview(); 68 this._networkOverview = new WebInspector.NetworkOverview();
64 this._overviewPane.setOverviewControls([this._networkOverview]); 69 this._overviewPane.setOverviewControls([this._networkOverview]);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 this._panelToolbar.appendSeparator(); 155 this._panelToolbar.appendSeparator();
151 156
152 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"));
153 this._preserveLogCheckbox.inputElement.addEventListener("change", this._ onPreserveLogCheckboxChanged.bind(this), false); 158 this._preserveLogCheckbox.inputElement.addEventListener("change", this._ onPreserveLogCheckboxChanged.bind(this), false);
154 this._panelToolbar.appendToolbarItem(this._preserveLogCheckbox); 159 this._panelToolbar.appendToolbarItem(this._preserveLogCheckbox);
155 160
156 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"));
157 this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox); 162 this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox);
158 163
159 this._panelToolbar.appendSeparator(); 164 this._panelToolbar.appendSeparator();
165 if (Runtime.experiments.isEnabled("blockedURLs"))
166 this._panelToolbar.appendToolbarItem(this._blockedURLsBar.toolbarBu tton());
160 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect ()); 167 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect ());
161 this._panelToolbar.appendToolbarItem(new WebInspector.ToolbarItem(this._ progressBarContainer)); 168 this._panelToolbar.appendToolbarItem(new WebInspector.ToolbarItem(this._ progressBarContainer));
162 }, 169 },
163 170
164 /** 171 /**
165 * @return {!WebInspector.ToolbarComboBox} 172 * @return {!WebInspector.ToolbarComboBox}
166 */ 173 */
167 _createNetworkConditionsSelect: function() 174 _createNetworkConditionsSelect: function()
168 { 175 {
169 var toolbarItem = new WebInspector.ToolbarComboBox(null); 176 var toolbarItem = new WebInspector.ToolbarComboBox(null);
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 { 738 {
732 if (!this._target) 739 if (!this._target)
733 return; 740 return;
734 741
735 this._target.tracingManager.stop(); 742 this._target.tracingManager.stop();
736 this._target = null; 743 this._target = null;
737 this._callback = callback; 744 this._callback = callback;
738 this._filmStripView.setStatusText(WebInspector.UIString("Fetching frames ...")); 745 this._filmStripView.setStatusText(WebInspector.UIString("Fetching frames ..."));
739 } 746 }
740 } 747 }
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 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/network/NetworkLogView.js ('k') | Source/devtools/front_end/network/networkPanel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698