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

Unified Diff: ui/webui/resources/cr_elements/cr_onc/cr_onc_data.js

Issue 954293003: Support badges and connecting animation in cr-network-icon element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More Feedback Created 5 years, 10 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: ui/webui/resources/cr_elements/cr_onc/cr_onc_data.js
diff --git a/ui/webui/resources/cr_elements/cr_onc/cr_onc_data.js b/ui/webui/resources/cr_elements/cr_onc/cr_onc_data.js
index 4bca1d248b62abf898e2c237b8b1237cd4a04c36..01b0f550536ff01d672ee0c8411f78fe364cf9b2 100644
--- a/ui/webui/resources/cr_elements/cr_onc/cr_onc_data.js
+++ b/ui/webui/resources/cr_elements/cr_onc/cr_onc_data.js
@@ -22,13 +22,22 @@ Polymer('cr-onc-data', {
data: null,
},
+ /** @override */
created: function() {
this.data = /** @type {CrOnc.NetworkConfigType} */({});
},
- /**
- * @return {number} The signal strength of the network.
- */
+ /** @return {boolean} True if the network is connected. */
+ connected: function() {
+ return this.data.ConnectionState == CrOnc.ConnectionState.CONNECTED;
+ },
+
+ /** @return {boolean} True if the network is connecting. */
+ connecting: function() {
+ return this.data.ConnectionState == CrOnc.ConnectionState.CONNECTING;
+ },
+
+ /** @return {number} The signal strength of the network. */
getStrength: function() {
var type = this.data.Type;
var strength = 0;
@@ -41,12 +50,21 @@ Polymer('cr-onc-data', {
return strength;
},
- /**
- * Returns the WiFi security type. Undefined or empty defaults to 'None'.
- * @return {string} The WiFi security type.
- */
+ /** @return {CrOnc.Security} The ONC security type. */
getWiFiSecurity: function() {
return (this.data.WiFi && this.data.WiFi.Security) ?
- this.data.WiFi.Security : 'None';
+ this.data.WiFi.Security : CrOnc.Security.NONE;
+ },
+
+ /** @return {CrOnc.RoamingState} The ONC roaming state. */
+ getCellularRoamingState: function() {
+ return (this.data.Cellular && this.data.Cellular.RoamingState) ?
+ this.data.Cellular.RoamingState : CrOnc.RoamingState.UNKNOWN;
+ },
+
+ /** @return {CrOnc.NetworkTechnology} The ONC network technology. */
+ getCellularTechnology: function() {
+ return (this.data.Cellular && this.data.Cellular.NetworkTechnology) ?
+ this.data.Cellular.NetworkTechnology : CrOnc.NetworkTechnology.UNKNOWN;
}
});
« no previous file with comments | « ui/webui/resources/cr_elements/cr_network_icon/secure.png ('k') | ui/webui/resources/cr_elements/cr_onc/cr_onc_types.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698