Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview ONC network configuration support class. Wraps a dictionary | |
|
Dan Beam
2015/02/20 01:02:43
why @fileoverview on separate line in other files
stevenjb
2015/02/20 02:22:47
Which other files? This seems to be the more commo
| |
| 7 * object containing ONC managed or unmanaged dictionaries. Also provides | |
| 8 * special accessors for ONC properties. See cr-onc-types for ONC types, | |
| 9 * e.g. CrOnc.NetworkConfigType. Used by consumers of the | |
| 10 * chrome.networkingPrivate API. See components/onc/docs/onc_spec.html. | |
| 11 */ | |
| 12 | |
|
Dan Beam
2015/02/20 01:02:43
why extra \n?
stevenjb
2015/02/20 02:22:48
Done.
| |
| 13 Polymer('cr-onc-data', { | |
| 14 publish: { | |
| 15 /** | |
| 16 * ONC configuration property dictionary, e.g. the result of a | |
| 17 * chrome.networkingPrivate.getProperties() call. | |
| 18 * | |
| 19 * @attribute data | |
| 20 * @type CrOnc.NetworkConfigType | |
| 21 * @default null | |
| 22 */ | |
| 23 data: null | |
| 24 }, | |
| 25 | |
| 26 created: function() { | |
|
Dan Beam
2015/02/20 01:02:43
/** @type {CrOnc.NetworkConfigType} */
stevenjb
2015/02/20 02:22:48
Done.
| |
| 27 this.data = {}; | |
| 28 }, | |
| 29 | |
| 30 /** | |
| 31 * @return {number} The signal strength of the network. | |
| 32 */ | |
| 33 getStrength: function() { | |
| 34 var type = this.data.Type; | |
| 35 var strength = 0; | |
| 36 if (type == 'WiFi') { | |
| 37 strength = this.data.WiFi ? this.data.WiFi.SignalStrength : 0; | |
| 38 } else if (type == 'Cellular') { | |
| 39 strength = this.data.Cellular ? this.data.Cellular.SignalStrength : 0; | |
| 40 } else if (type == 'WiMAX') { | |
| 41 strength = this.data.WiMAX ? this.data.WiMAX.SignalStrength : 0; | |
| 42 } | |
|
Dan Beam
2015/02/20 01:02:44
no curlies
stevenjb
2015/02/20 02:22:48
Done.
| |
| 43 return strength; | |
| 44 }, | |
| 45 | |
| 46 /** | |
| 47 * Returns the WiFi security type. Undefined or empty defaults to 'None'. | |
| 48 * @return {string} The WiFi security type. | |
| 49 */ | |
| 50 getWiFiSecurity: function() { | |
| 51 var security = this.data.WiFi ? this.data.WiFi.Security : undefined; | |
|
Dan Beam
2015/02/20 01:02:43
nit: return this.data.WiFi && this.data.WiFi.Secur
stevenjb
2015/02/20 02:22:48
Wow, I find that extremely non intuitive for a non
| |
| 52 if (security) | |
| 53 return security; | |
| 54 return 'None'; | |
| 55 } | |
| 56 }); | |
| OLD | NEW |