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

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js

Issue 1833423003: [DevTools] Use plain text for network conditions menu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed review comment Created 4 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 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: third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js b/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js
index bf851ab09e0680b7e27f9ea6ca9a9f755247d203..5f9d8f2d7bcac0b1705a0463f426910725491a25 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js
@@ -23,18 +23,20 @@ WebInspector.NetworkConditionsGroup;
/**
* @param {number} throughput
+ * @param {boolean=} plainText
* @return {string}
*/
-WebInspector.NetworkConditionsSelector._throughputText = function(throughput)
+WebInspector.NetworkConditionsSelector._throughputText = function(throughput, plainText)
{
if (throughput < 0)
return "";
var throughputInKbps = throughput / (1024 / 8);
+ var delimiter = plainText ? "" : " ";
if (throughputInKbps < 1024)
- return WebInspector.UIString("%d kb/s", throughputInKbps);
+ return WebInspector.UIString("%d%skb/s", throughputInKbps, delimiter);
if (throughputInKbps < 1024 * 10)
- return WebInspector.UIString("%.1f Mb/s", throughputInKbps / 1024);
- return WebInspector.UIString("%d Mb/s", (throughputInKbps / 1024) | 0);
+ return WebInspector.UIString("%.1f%sMb/s", throughputInKbps / 1024, delimiter);
+ return WebInspector.UIString("%d%sMb/s", (throughputInKbps / 1024) | 0, delimiter);
}
/** @type {!Array.<!WebInspector.NetworkManager.Conditions>} */
@@ -52,9 +54,10 @@ WebInspector.NetworkConditionsSelector._presets = [
/**
* @param {!WebInspector.NetworkManager.Conditions} conditions
+ * @param {boolean=} plainText
* @return {!{text: string, title: string}}
*/
-WebInspector.NetworkConditionsSelector._conditionsTitle = function(conditions)
+WebInspector.NetworkConditionsSelector._conditionsTitle = function(conditions, plainText)
{
var downloadInKbps = conditions.download / (1024 / 8);
var uploadInKbps = conditions.upload / (1024 / 8);
@@ -63,9 +66,10 @@ WebInspector.NetworkConditionsSelector._conditionsTitle = function(conditions)
if (!isThrottling)
return {text: conditionTitle, title: conditionTitle};
- var downloadText = WebInspector.NetworkConditionsSelector._throughputText(conditions.download);
- var uploadText = WebInspector.NetworkConditionsSelector._throughputText(conditions.upload);
- var title = WebInspector.UIString("%s (%s\u2b07 %s\u2b06 %dms RTT)", conditionTitle, downloadText, uploadText, conditions.latency);
+ var downloadText = WebInspector.NetworkConditionsSelector._throughputText(conditions.download, plainText);
+ var uploadText = WebInspector.NetworkConditionsSelector._throughputText(conditions.upload, plainText);
+ var pattern = plainText ? "%s (%dms, %s, %s)" : "%s (%dms RTT, %s\u2b07, %s\u2b06)";
+ var title = WebInspector.UIString(pattern, conditionTitle, conditions.latency, downloadText, uploadText);
return {text: title, title: WebInspector.UIString("Maximum download throughput: %s.\r\nMaximum upload throughput: %s.\r\nMinimum round-trip time: %dms.", downloadText, uploadText, conditions.latency)};
}
@@ -196,7 +200,7 @@ WebInspector.NetworkConditionsSelector.createToolbarMenuButton = function()
if (!conditions)
contextMenu.appendSeparator();
else
- contextMenu.appendCheckboxItem(WebInspector.NetworkConditionsSelector._conditionsTitle(conditions).text, selector.optionSelected.bind(selector, conditions), selectedIndex === index);
+ contextMenu.appendCheckboxItem(WebInspector.NetworkConditionsSelector._conditionsTitle(conditions, true).text, selector.optionSelected.bind(selector, conditions), selectedIndex === index);
}
contextMenu.appendItem(WebInspector.UIString("Edit\u2026"), selector.revealAndUpdate.bind(selector));
}
« 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