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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/main/Main.js
diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js
index 0dc04d7b98465cf8340759cd69fc87a2b51b4098..411726f7c4b735c8c66bbea6366e124946c39132 100644
--- a/third_party/WebKit/Source/devtools/front_end/main/Main.js
+++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
@@ -201,6 +201,7 @@ Main.Main = class {
new Main.Main.PauseListener();
new Main.Main.InspectedNodeRevealer();
+ new Main.NetworkPanelIndicator();
new Main.SourcesPanelIndicator();
new Main.BackendSettingsSync();
Components.domBreakpointsSidebarPane = new Components.DOMBreakpointsSidebarPane();
@@ -750,6 +751,33 @@ Main.Main.MainMenuItem = class {
}
};
+Main.NetworkPanelIndicator = class {
+ constructor() {
+ // TODO: we should not access network from other modules.
+ if (!UI.inspectorView.hasPanel('network'))
+ return;
+ var manager = SDK.multitargetNetworkManager;
+ manager.addEventListener(SDK.MultitargetNetworkManager.Events.ConditionsChanged, updateVisibility);
+ var blockedURLsSetting = Common.moduleSetting('networkBlockedURLs');
+ blockedURLsSetting.addChangeListener(updateVisibility);
+ var requestBlockingEnabledSetting = Common.moduleSetting('requestBlockingEnabled');
+ requestBlockingEnabledSetting.addChangeListener(updateVisibility);
+ updateVisibility();
+
+ function updateVisibility() {
+ var icon = null;
+ if (manager.isThrottling()) {
+ icon = UI.Icon.create('smallicon-warning');
+ icon.title = Common.UIString('Network throttling is enabled');
+ } else if (requestBlockingEnabledSetting.get() && blockedURLsSetting.get().length) {
+ icon = UI.Icon.create('smallicon-warning');
+ icon.title = Common.UIString('Requests may be blocked');
+ }
+ UI.inspectorView.setPanelIcon('network', icon);
+ }
+ }
+};
+
/**
* @unrestricted
*/

Powered by Google App Engine
This is Rietveld 408576698