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

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: Rebase + Elim extra div in icon 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
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 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698