Chromium Code Reviews| 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() { |
|
Jeremy Klein
2015/03/03 00:41:08
Another totally optional alternative polymer tip:
stevenjb
2015/03/03 01:07:08
Interesting thought. When looking at Expressions f
Jeremy Klein
2015/03/03 01:26:20
I see what you mean about the string, but computed
|
| + 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; |
| } |
| }); |