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

Side by Side Diff: ui/webui/resources/cr_elements/network/cr_network_icon.js

Issue 2838323002: [CrOS Tether] Add tether settings section to the MD settings page. (Closed)
Patch Set: Fix Closure compiler error. Created 3 years, 7 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Polymer element for rendering network icons based on ONC 6 * @fileoverview Polymer element for rendering network icons based on ONC
7 * state properties. 7 * state properties.
8 */ 8 */
9 9
10 Polymer({ 10 Polymer({
(...skipping 25 matching lines...) Expand all
36 */ 36 */
37 getIconClass_: function() { 37 getIconClass_: function() {
38 if (!this.networkState) 38 if (!this.networkState)
39 return ''; 39 return '';
40 var type = this.networkState.Type; 40 var type = this.networkState.Type;
41 if (type == CrOnc.Type.ETHERNET) 41 if (type == CrOnc.Type.ETHERNET)
42 return 'ethernet'; 42 return 'ethernet';
43 if (type == CrOnc.Type.VPN) 43 if (type == CrOnc.Type.VPN)
44 return 'vpn'; 44 return 'vpn';
45 45
46 var prefix = type == CrOnc.Type.CELLULAR ? 'cellular-' : 'wifi-'; 46 var prefix = (type == CrOnc.Type.CELLULAR || type == CrOnc.Type.TETHER) ?
47 'cellular-' :
48 'wifi-';
47 var connectionState = this.networkState.ConnectionState; 49 var connectionState = this.networkState.ConnectionState;
48 if (connectionState == CrOnc.ConnectionState.CONNECTING) 50 if (connectionState == CrOnc.ConnectionState.CONNECTING)
49 return prefix + 'connecting'; 51 return prefix + 'connecting';
50 var strength; 52 var strength;
51 if (!this.isListItem && 53 if (!this.isListItem &&
52 (!connectionState || 54 (!connectionState ||
53 connectionState == CrOnc.ConnectionState.NOT_CONNECTED)) { 55 connectionState == CrOnc.ConnectionState.NOT_CONNECTED)) {
54 if (type != CrOnc.Type.CELLULAR) 56 if (type != CrOnc.Type.CELLULAR && type != CrOnc.Type.TETHER)
55 return prefix + 'off'; 57 return prefix + 'off';
56 strength = 0; 58 strength = 0;
57 } else { 59 } else {
58 strength = CrOnc.getSignalStrength(this.networkState); 60 strength = CrOnc.getSignalStrength(this.networkState);
59 } 61 }
60 return prefix + this.strengthToIndex_(strength).toString(10); 62 return prefix + this.strengthToIndex_(strength).toString(10);
61 }, 63 },
62 64
63 /** 65 /**
64 * @param {number} strength The signal strength from [0 - 100]. 66 * @param {number} strength The signal strength from [0 - 100].
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 if (networkState.Type != CrOnc.Type.WI_FI || !networkState.WiFi) 142 if (networkState.Type != CrOnc.Type.WI_FI || !networkState.WiFi)
141 return false; 143 return false;
142 if (!this.isListItem && 144 if (!this.isListItem &&
143 networkState.ConnectionState == CrOnc.ConnectionState.NOT_CONNECTED) { 145 networkState.ConnectionState == CrOnc.ConnectionState.NOT_CONNECTED) {
144 return false; 146 return false;
145 } 147 }
146 var security = networkState.WiFi.Security; 148 var security = networkState.WiFi.Security;
147 return !!security && security != 'None'; 149 return !!security && security != 'None';
148 }, 150 },
149 }); 151 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698