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

Side by Side Diff: ui/webui/resources/cr_elements/cr_onc/cr_onc_data.js

Issue 874283006: Add custom Polymer network icon element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge fix 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 unified diff | Download patch
OLDNEW
(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,
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';
51 }
52 });
OLDNEW
« no previous file with comments | « ui/webui/resources/cr_elements/cr_onc/cr_onc_data.html ('k') | ui/webui/resources/cr_elements/cr_onc/cr_onc_data_externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698