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

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

Issue 2765443005: [Devtools] Fixed network indicator icon for throttling (Closed)
Patch Set: added tests Created 3 years, 8 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 new Persistence.FileSystemWorkspaceBinding(Workspace.isolatedFileSystemManag er, Workspace.workspace); 194 new Persistence.FileSystemWorkspaceBinding(Workspace.isolatedFileSystemManag er, Workspace.workspace);
195 Persistence.persistence = 195 Persistence.persistence =
196 new Persistence.Persistence(Workspace.workspace, Bindings.breakpointMana ger, Workspace.fileSystemMapping); 196 new Persistence.Persistence(Workspace.workspace, Bindings.breakpointMana ger, Workspace.fileSystemMapping);
197 197
198 new Main.OverlayController(); 198 new Main.OverlayController();
199 new Main.ExecutionContextSelector(SDK.targetManager, UI.context); 199 new Main.ExecutionContextSelector(SDK.targetManager, UI.context);
200 Bindings.blackboxManager = new Bindings.BlackboxManager(Bindings.debuggerWor kspaceBinding); 200 Bindings.blackboxManager = new Bindings.BlackboxManager(Bindings.debuggerWor kspaceBinding);
201 201
202 new Main.Main.PauseListener(); 202 new Main.Main.PauseListener();
203 new Main.Main.InspectedNodeRevealer(); 203 new Main.Main.InspectedNodeRevealer();
204 new Main.NetworkPanelIndicator();
204 new Main.SourcesPanelIndicator(); 205 new Main.SourcesPanelIndicator();
205 new Main.BackendSettingsSync(); 206 new Main.BackendSettingsSync();
206 Components.domBreakpointsSidebarPane = new Components.DOMBreakpointsSidebarP ane(); 207 Components.domBreakpointsSidebarPane = new Components.DOMBreakpointsSidebarP ane();
207 208
208 UI.actionRegistry = new UI.ActionRegistry(); 209 UI.actionRegistry = new UI.ActionRegistry();
209 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document); 210 UI.shortcutRegistry = new UI.ShortcutRegistry(UI.actionRegistry, document);
210 UI.ShortcutsScreen.registerShortcuts(); 211 UI.ShortcutsScreen.registerShortcuts();
211 this._registerForwardedShortcuts(); 212 this._registerForwardedShortcuts();
212 this._registerMessageSinkListener(); 213 this._registerMessageSinkListener();
213 new Main.Main.InspectorDomainObserver(); 214 new Main.Main.InspectorDomainObserver();
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 } 744 }
744 745
745 var helpSubMenu = contextMenu.namedSubMenu('mainMenuHelp'); 746 var helpSubMenu = contextMenu.namedSubMenu('mainMenuHelp');
746 helpSubMenu.appendAction('settings.documentation'); 747 helpSubMenu.appendAction('settings.documentation');
747 if (Runtime.experiments.isEnabled('releaseNote')) 748 if (Runtime.experiments.isEnabled('releaseNote'))
748 helpSubMenu.appendItem('Release Notes', () => InspectorFrontendHost.openIn NewTab(Help.latestReleaseNote().link)); 749 helpSubMenu.appendItem('Release Notes', () => InspectorFrontendHost.openIn NewTab(Help.latestReleaseNote().link));
749 contextMenu.show(); 750 contextMenu.show();
750 } 751 }
751 }; 752 };
752 753
754 Main.NetworkPanelIndicator = class {
755 constructor() {
756 // TODO: we should not access network from other modules.
757 if (!UI.inspectorView.hasPanel('network'))
758 return;
759 var manager = SDK.multitargetNetworkManager;
760 manager.addEventListener(SDK.MultitargetNetworkManager.Events.ConditionsChan ged, updateVisibility);
761 var blockedURLsSetting = Common.moduleSetting('networkBlockedURLs');
762 blockedURLsSetting.addChangeListener(updateVisibility);
763 var requestBlockingEnabledSetting = Common.moduleSetting('requestBlockingEna bled');
764 requestBlockingEnabledSetting.addChangeListener(updateVisibility);
765 updateVisibility();
766
767 function updateVisibility() {
768 var icon = null;
769 if (manager.isThrottling()) {
770 icon = UI.Icon.create('smallicon-warning');
771 icon.title = Common.UIString('Network throttling is enabled');
772 } else if (requestBlockingEnabledSetting.get() && blockedURLsSetting.get() .length) {
773 icon = UI.Icon.create('smallicon-warning');
774 icon.title = Common.UIString('Requests may be blocked');
775 }
776 UI.inspectorView.setPanelIcon('network', icon);
777 }
778 }
779 };
780
753 /** 781 /**
754 * @unrestricted 782 * @unrestricted
755 */ 783 */
756 Main.SourcesPanelIndicator = class { 784 Main.SourcesPanelIndicator = class {
757 constructor() { 785 constructor() {
758 Common.moduleSetting('javaScriptDisabled').addChangeListener(javaScriptDisab ledChanged); 786 Common.moduleSetting('javaScriptDisabled').addChangeListener(javaScriptDisab ledChanged);
759 javaScriptDisabledChanged(); 787 javaScriptDisabledChanged();
760 788
761 function javaScriptDisabledChanged() { 789 function javaScriptDisabledChanged() {
762 var icon = null; 790 var icon = null;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 * @override 981 * @override
954 * @return {?Element} 982 * @return {?Element}
955 */ 983 */
956 settingElement() { 984 settingElement() {
957 return UI.SettingsUI.createSettingCheckbox( 985 return UI.SettingsUI.createSettingCheckbox(
958 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' )); 986 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers' ));
959 } 987 }
960 }; 988 };
961 989
962 new Main.Main(); 990 new Main.Main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698