 Chromium Code Reviews
 Chromium Code Reviews Issue 874283006:
  Add custom Polymer network icon element  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 874283006:
  Add custom Polymer network icon element  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 | |
| 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 Polymer('cr-onc-data', { | |
| 13 publish: { | |
| 14 /** | |
| 15 * ONC configuration property dictionary, e.g. the result of a | |
| 16 * chrome.networkingPrivate.getProperties() call. | |
| 17 * | |
| 18 * @attribute data | |
| 19 * @type CrOnc.NetworkConfigType | |
| 20 * @default null | |
| 21 */ | |
| 22 data: null | |
| 
michaelpg
2015/02/24 07:24:57
nit: trailing comma
 
stevenjb
2015/02/24 19:28:00
Done.
 | |
| 23 }, | |
| 24 | |
| 25 created: function() { | |
| 26 this.data = /** @type {CrOnc.NetworkConfigType} */({}); | |
| 27 }, | |
| 28 | |
| 29 /** | |
| 30 * @return {number} The signal strength of the network. | |
| 31 */ | |
| 32 getStrength: function() { | |
| 33 var type = this.data.Type; | |
| 34 var strength = 0; | |
| 35 if (type == 'WiFi') | |
| 36 strength = this.data.WiFi ? this.data.WiFi.SignalStrength : 0; | |
| 37 else if (type == 'Cellular') | |
| 38 strength = this.data.Cellular ? this.data.Cellular.SignalStrength : 0; | |
| 39 else if (type == 'WiMAX') | |
| 40 strength = this.data.WiMAX ? this.data.WiMAX.SignalStrength : 0; | |
| 41 return strength; | |
| 42 }, | |
| 43 | |
| 44 /** | |
| 45 * Returns the WiFi security type. Undefined or empty defaults to 'None'. | |
| 46 * @return {string} The WiFi security type. | |
| 47 */ | |
| 48 getWiFiSecurity: function() { | |
| 49 return (this.data.WiFi && this.data.WiFi.Security) ? | |
| 50 this.data.WiFi.Security : 'None'; | |
| 
michaelpg
2015/02/24 07:24:57
4 spaces or align with the (
 
stevenjb
2015/02/24 19:28:00
Done.
 | |
| 51 } | |
| 52 }); | |
| OLD | NEW |