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

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: Merge branch 'master' of https://chromium.googlesource.com/chromium/src into ADD_ENABLE_DISABLE_REQ… 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 new Persistence.FileSystemWorkspaceBinding(Workspace.isolatedFileSystemManag er, Workspace.workspace); 192 new Persistence.FileSystemWorkspaceBinding(Workspace.isolatedFileSystemManag er, Workspace.workspace);
193 Persistence.persistence = 193 Persistence.persistence =
194 new Persistence.Persistence(Workspace.workspace, Bindings.breakpointMana ger, Workspace.fileSystemMapping); 194 new Persistence.Persistence(Workspace.workspace, Bindings.breakpointMana ger, Workspace.fileSystemMapping);
195 195
196 new Main.OverlayController(); 196 new Main.OverlayController();
197 new Main.ExecutionContextSelector(SDK.targetManager, UI.context); 197 new Main.ExecutionContextSelector(SDK.targetManager, UI.context);
198 Bindings.blackboxManager = new Bindings.BlackboxManager(Bindings.debuggerWor kspaceBinding); 198 Bindings.blackboxManager = new Bindings.BlackboxManager(Bindings.debuggerWor kspaceBinding);
199 199
200 new Main.Main.PauseListener(); 200 new Main.Main.PauseListener();
201 new Main.Main.InspectedNodeRevealer(); 201 new Main.Main.InspectedNodeRevealer();
202 new Main.NetworkPanelIndicator();
203 new Main.SourcesPanelIndicator(); 202 new Main.SourcesPanelIndicator();
204 new Main.BackendSettingsSync(); 203 new Main.BackendSettingsSync();
205 Components.domBreakpointsSidebarPane = new Components.DOMBreakpointsSidebarP ane(); 204 Components.domBreakpointsSidebarPane = new Components.DOMBreakpointsSidebarP ane();
206 205
207 UI.actionRegistry = new UI.ActionRegistry(); 206 UI.actionRegistry = new UI.ActionRegistry();
208 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document); 207 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document);
209 UI.ShortcutsScreen.registerShortcuts(); 208 UI.ShortcutsScreen.registerShortcuts();
210 this._registerForwardedShortcuts(); 209 this._registerForwardedShortcuts();
211 this._registerMessageSinkListener(); 210 this._registerMessageSinkListener();
212 new Main.Main.InspectorDomainObserver(); 211 new Main.Main.InspectorDomainObserver();
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 helpSubMenu.appendAction('settings.documentation'); 749 helpSubMenu.appendAction('settings.documentation');
751 if (Runtime.experiments.isEnabled('releaseNote')) 750 if (Runtime.experiments.isEnabled('releaseNote'))
752 helpSubMenu.appendItem('Release Notes', () => InspectorFrontendHost.openIn NewTab(Help.latestReleaseNote().link)); 751 helpSubMenu.appendItem('Release Notes', () => InspectorFrontendHost.openIn NewTab(Help.latestReleaseNote().link));
753 contextMenu.show(); 752 contextMenu.show();
754 } 753 }
755 }; 754 };
756 755
757 /** 756 /**
758 * @unrestricted 757 * @unrestricted
759 */ 758 */
760 Main.NetworkPanelIndicator = class {
761 constructor() {
762 // TODO: we should not access network from other modules.
763 if (!UI.inspectorView.hasPanel('network'))
764 return;
765 var manager = SDK.multitargetNetworkManager;
766 manager.addEventListener(SDK.MultitargetNetworkManager.Events.ConditionsChan ged, updateVisibility);
767 var blockedURLsSetting = Common.moduleSetting('networkBlockedURLs');
768 blockedURLsSetting.addChangeListener(updateVisibility);
769 updateVisibility();
770
771 function updateVisibility() {
772 var icon = null;
773 if (manager.isThrottling()) {
774 icon = UI.Icon.create('smallicon-warning');
775 icon.title = Common.UIString('Network throttling is enabled');
776 } else if (blockedURLsSetting.get().length) {
777 icon = UI.Icon.create('smallicon-warning');
778 icon.title = Common.UIString('Requests may be blocked');
779 }
780 UI.inspectorView.setPanelIcon('network', icon);
781 }
782 }
783 };
784
785 /**
786 * @unrestricted
787 */
788 Main.SourcesPanelIndicator = class { 759 Main.SourcesPanelIndicator = class {
789 constructor() { 760 constructor() {
790 Common.moduleSetting('javaScriptDisabled').addChangeListener(javaScriptDisab ledChanged); 761 Common.moduleSetting('javaScriptDisabled').addChangeListener(javaScriptDisab ledChanged);
791 javaScriptDisabledChanged(); 762 javaScriptDisabledChanged();
792 763
793 function javaScriptDisabledChanged() { 764 function javaScriptDisabledChanged() {
794 var icon = null; 765 var icon = null;
795 var javaScriptDisabled = Common.moduleSetting('javaScriptDisabled').get(); 766 var javaScriptDisabled = Common.moduleSetting('javaScriptDisabled').get();
796 if (javaScriptDisabled) { 767 if (javaScriptDisabled) {
797 icon = UI.Icon.create('smallicon-warning'); 768 icon = UI.Icon.create('smallicon-warning');
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 * @override 956 * @override
986 * @return {?Element} 957 * @return {?Element}
987 */ 958 */
988 settingElement() { 959 settingElement() {
989 return UI.SettingsUI.createSettingCheckbox( 960 return UI.SettingsUI.createSettingCheckbox(
990 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' )); 961 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' ));
991 } 962 }
992 }; 963 };
993 964
994 new Main.Main(); 965 new Main.Main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698