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

Unified Diff: chrome/browser/resources/settings/internet_page/network_property_list.js

Issue 2838323002: [CrOS Tether] Add tether settings section to the MD settings page. (Closed)
Patch Set: Fix Closure compiler error. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/internet_page/network_property_list.js
diff --git a/chrome/browser/resources/settings/internet_page/network_property_list.js b/chrome/browser/resources/settings/internet_page/network_property_list.js
index d64e6225395d45b7563c9c923de695370ae7b790..ce5d805ff5caddaa74a8b75113d0100d27097274 100644
--- a/chrome/browser/resources/settings/internet_page/network_property_list.js
+++ b/chrome/browser/resources/settings/internet_page/network_property_list.js
@@ -157,6 +157,9 @@ Polymer({
value =
CrOnc.getActiveValue(/** @type {!CrOnc.ManagedProperty} */ (value));
}
+ var customValue = this.getCustomPropertyValue_(key, value);
+ if (customValue)
+ return customValue;
if (typeof value == 'number' || typeof value == 'boolean')
return value.toString();
assert(typeof value == 'string');
@@ -168,4 +171,41 @@ Polymer({
return this.i18n(oncKey);
return valueStr;
},
+
+ /**
+ * @param {string} key The property key.
+ * @param {*} value The property value.
+ * @return {string} The text to display for the property value. If the key
+ * does not correspond to a custom property, an empty string is returned.
+ */
+ getCustomPropertyValue_: function(key, value) {
+ if (key == 'Tether.BatteryPercentage') {
+ assert(typeof value == 'number');
+ return this.i18n('OncTether-BatteryPercentage_Value', value.toString());
+ }
+
+ if (key == 'Tether.SignalStrength') {
+ assert(typeof value == 'number');
+ // Possible |signalStrength| values should be 0, 25, 50, 75, and 100. Add
+ // <= checks for robustness.
+ if (value <= 24)
+ return this.i18n('OncTether-SignalStrength_Weak');
+ if (value <= 49)
+ return this.i18n('OncTether-SignalStrength_Okay');
+ if (value <= 74)
+ return this.i18n('OncTether-SignalStrength_Good');
+ if (value <= 99)
+ return this.i18n('OncTether-SignalStrength_Strong');
+ return this.i18n('OncTether-SignalStrength_VeryStrong');
+ }
+
+ if (key == 'Tether.Carrier') {
+ assert(typeof value == 'string');
+ return (!value || value == 'unknown-carrier')
+ ? this.i18n('tetherUnknownCarrier')
+ : value;
+ }
+
+ return '';
+ },
});

Powered by Google App Engine
This is Rietveld 408576698