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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/main/Main.js

Issue 2692653003: [Devtools] Added Enable/Disable for request blocking in network (Closed)
Patch Set: changes Created 3 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 new Persistence.FileSystemWorkspaceBinding(Workspace.isolatedFileSystemManag er, Workspace.workspace); 189 new Persistence.FileSystemWorkspaceBinding(Workspace.isolatedFileSystemManag er, Workspace.workspace);
190 Persistence.persistence = 190 Persistence.persistence =
191 new Persistence.Persistence(Workspace.workspace, Bindings.breakpointMana ger, Workspace.fileSystemMapping); 191 new Persistence.Persistence(Workspace.workspace, Bindings.breakpointMana ger, Workspace.fileSystemMapping);
192 192
193 new Main.OverlayController(); 193 new Main.OverlayController();
194 new Main.ExecutionContextSelector(SDK.targetManager, UI.context); 194 new Main.ExecutionContextSelector(SDK.targetManager, UI.context);
195 Bindings.blackboxManager = new Bindings.BlackboxManager(Bindings.debuggerWor kspaceBinding); 195 Bindings.blackboxManager = new Bindings.BlackboxManager(Bindings.debuggerWor kspaceBinding);
196 196
197 new Main.Main.PauseListener(); 197 new Main.Main.PauseListener();
198 new Main.Main.InspectedNodeRevealer(); 198 new Main.Main.InspectedNodeRevealer();
199 new Main.NetworkPanelIndicator();
200 new Main.SourcesPanelIndicator(); 199 new Main.SourcesPanelIndicator();
201 new Main.BackendSettingsSync(); 200 new Main.BackendSettingsSync();
202 Components.domBreakpointsSidebarPane = new Components.DOMBreakpointsSidebarP ane(); 201 Components.domBreakpointsSidebarPane = new Components.DOMBreakpointsSidebarP ane();
203 202
204 UI.actionRegistry = new UI.ActionRegistry(); 203 UI.actionRegistry = new UI.ActionRegistry();
205 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document); 204 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document);
206 UI.ShortcutsScreen.registerShortcuts(); 205 UI.ShortcutsScreen.registerShortcuts();
207 this._registerForwardedShortcuts(); 206 this._registerForwardedShortcuts();
208 this._registerMessageSinkListener(); 207 this._registerMessageSinkListener();
209 new Main.Main.InspectorDomainObserver(); 208 new Main.Main.InspectorDomainObserver();
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 moreTools.appendItem(extension.title(), UI.viewManager.showView.bind(UI.vi ewManager, descriptor['id'])); 740 moreTools.appendItem(extension.title(), UI.viewManager.showView.bind(UI.vi ewManager, descriptor['id']));
742 } 741 }
743 742
744 contextMenu.show(); 743 contextMenu.show();
745 } 744 }
746 }; 745 };
747 746
748 /** 747 /**
749 * @unrestricted 748 * @unrestricted
750 */ 749 */
751 Main.NetworkPanelIndicator = class {
752 constructor() {
753 // TODO: we should not access network from other modules.
754 if (!UI.inspectorView.hasPanel('network'))
755 return;
756 var manager = SDK.multitargetNetworkManager;
757 manager.addEventListener(SDK.MultitargetNetworkManager.Events.ConditionsChan ged, updateVisibility);
758 var blockedURLsSetting = Common.moduleSetting('networkBlockedURLs');
759 blockedURLsSetting.addChangeListener(updateVisibility);
760 updateVisibility();
761
762 function updateVisibility() {
763 var icon = null;
764 if (manager.isThrottling()) {
765 icon = UI.Icon.create('smallicon-warning');
766 icon.title = Common.UIString('Network throttling is enabled');
767 } else if (blockedURLsSetting.get().length) {
768 icon = UI.Icon.create('smallicon-warning');
769 icon.title = Common.UIString('Requests may be blocked');
770 }
771 UI.inspectorView.setPanelIcon('network', icon);
772 }
773 }
774 };
775
776 /**
777 * @unrestricted
778 */
779 Main.SourcesPanelIndicator = class { 750 Main.SourcesPanelIndicator = class {
780 constructor() { 751 constructor() {
781 Common.moduleSetting('javaScriptDisabled').addChangeListener(javaScriptDisab ledChanged); 752 Common.moduleSetting('javaScriptDisabled').addChangeListener(javaScriptDisab ledChanged);
782 javaScriptDisabledChanged(); 753 javaScriptDisabledChanged();
783 754
784 function javaScriptDisabledChanged() { 755 function javaScriptDisabledChanged() {
785 var icon = null; 756 var icon = null;
786 var javaScriptDisabled = Common.moduleSetting('javaScriptDisabled').get(); 757 var javaScriptDisabled = Common.moduleSetting('javaScriptDisabled').get();
787 if (javaScriptDisabled) { 758 if (javaScriptDisabled) {
788 icon = UI.Icon.create('smallicon-warning'); 759 icon = UI.Icon.create('smallicon-warning');
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 * @override 947 * @override
977 * @return {?Element} 948 * @return {?Element}
978 */ 949 */
979 settingElement() { 950 settingElement() {
980 return UI.SettingsUI.createSettingCheckbox( 951 return UI.SettingsUI.createSettingCheckbox(
981 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' )); 952 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' ));
982 } 953 }
983 }; 954 };
984 955
985 new Main.Main(); 956 new Main.Main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698