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

Unified Diff: Source/devtools/front_end/emulation/DeviceModeButton.js

Issue 1205083002: [DevTools] Show warning on device mode button when network throttling is enabled. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/emulation/DeviceModeButton.js
diff --git a/Source/devtools/front_end/emulation/DeviceModeButton.js b/Source/devtools/front_end/emulation/DeviceModeButton.js
index a69910e17b5ff96f95ffaf066425734137211577..535041407732aa9f9c5e81d237f749089203588d 100644
--- a/Source/devtools/front_end/emulation/DeviceModeButton.js
+++ b/Source/devtools/front_end/emulation/DeviceModeButton.js
@@ -11,9 +11,12 @@ WebInspector.DeviceModeButtonProvider = function()
var button = new WebInspector.ToolbarButton(WebInspector.UIString("Toggle device mode"), "emulation-toolbar-item");
button.addEventListener("click", toggleEmulationEnabled);
WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport.Events.EmulationStateChanged, emulationEnabledChanged);
- WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport.Events.OverridesWarningUpdated, overridesWarningUpdated);
+ WebInspector.overridesSupport.addEventListener(WebInspector.OverridesSupport.Events.OverridesWarningUpdated, updateWarning);
+ var networkConditionsSetting = WebInspector.moduleSetting("networkConditions");
+ networkConditionsSetting.addChangeListener(updateWarning);
+
emulationEnabledChanged();
- overridesWarningUpdated();
+ updateWarning();
function toggleEmulationEnabled()
{
@@ -25,9 +28,11 @@ WebInspector.DeviceModeButtonProvider = function()
button.setToggled(WebInspector.overridesSupport.emulationEnabled());
}
- function overridesWarningUpdated()
+ function updateWarning()
{
var message = WebInspector.overridesSupport.warningMessage();
+ if (!message && networkConditionsSetting.get().throughput >= 0)
+ message = WebInspector.UIString("Network throttling is enabled");
button.setTitle(message || WebInspector.UIString("Toggle device mode"));
button.element.classList.toggle("warning", !!message);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698