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

Side by Side Diff: chrome/browser/resources/settings/internet_page/network_summary_item.js

Issue 2824493003: MD Settings: Elim is-list-item from cr-network-list-item (Closed)
Patch Set: . Created 3 years, 8 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 displaying the network state for a specific 6 * @fileoverview Polymer element for displaying the network state for a specific
7 * type and a list of networks for that type. 7 * type and a list of networks for that type.
8 */ 8 */
9 9
10 /** @typedef {chrome.networkingPrivate.DeviceStateProperties} */ 10 /** @typedef {chrome.networkingPrivate.DeviceStateProperties} */
11 var DeviceStateProperties; 11 var DeviceStateProperties;
12 12
13 Polymer({ 13 Polymer({
14 is: 'network-summary-item', 14 is: 'network-summary-item',
15 15
16 behaviors: [I18nBehavior], 16 behaviors: [CrPolicyNetworkBehavior, I18nBehavior],
17 17
18 properties: { 18 properties: {
19 /** 19 /**
20 * Device state for the network type. 20 * Device state for the network type.
21 * @type {!DeviceStateProperties|undefined} 21 * @type {!DeviceStateProperties|undefined}
22 */ 22 */
23 deviceState: Object, 23 deviceState: Object,
24 24
25 /** 25 /**
26 * Network state for the active network. 26 * Network state for the active network.
(...skipping 13 matching lines...) Expand all
40 }, 40 },
41 41
42 /** 42 /**
43 * Interface for networkingPrivate calls, passed from internet_page. 43 * Interface for networkingPrivate calls, passed from internet_page.
44 * @type {!NetworkingPrivate} 44 * @type {!NetworkingPrivate}
45 */ 45 */
46 networkingPrivate: Object, 46 networkingPrivate: Object,
47 }, 47 },
48 48
49 /** 49 /**
50 * @return {string}
51 * @private
52 */
53 getNetworkName_: function() {
54 return CrOncStrings['OncType' + this.activeNetworkState.Type];
55 },
56
57 /**
58 * @return {string}
59 * @private
60 */
61 getNetworkStateText_: function() {
62 var network = this.activeNetworkState;
63 var state = network.ConnectionState;
64 var name = CrOnc.getNetworkName(network);
65 if (state)
66 return this.getConnectionStateText_(state, name);
67 if (this.deviceIsEnabled_(this.deviceState))
68 return CrOncStrings.networkListItemNotConnected;
69 return this.i18n('deviceOff');
70 },
71
72 /**
73 * @param {CrOnc.ConnectionState} state
74 * @param {string} name
75 * @return {string}
76 * @private
77 */
78 getConnectionStateText_: function(state, name) {
79 switch (state) {
80 case CrOnc.ConnectionState.CONNECTED:
81 return name;
82 case CrOnc.ConnectionState.CONNECTING:
83 if (name)
84 return CrOncStrings.networkListItemConnectingTo.replace('$1', name);
85 return CrOncStrings.networkListItemConnecting;
86 case CrOnc.ConnectionState.NOT_CONNECTED:
87 return CrOncStrings.networkListItemNotConnected;
88 }
89 assertNotReached();
90 return state;
91 },
92
93 /**
94 * @return {boolean}
95 * @private
96 */
97 showPolicyIndicator_() {
98 var network = this.activeNetworkState;
99 return network.ConnectionState == CrOnc.ConnectionState.CONNECTED ||
100 this.isPolicySource(network.Source);
101 },
102
103 /**
50 * Show the <network-siminfo> element if this is a disabled and locked 104 * Show the <network-siminfo> element if this is a disabled and locked
51 * cellular device. 105 * cellular device.
52 * @return {boolean} 106 * @return {boolean}
53 * @private 107 * @private
54 */ 108 */
55 showSimInfo_: function() { 109 showSimInfo_: function() {
56 var device = this.deviceState; 110 var device = this.deviceState;
57 if (device.Type != CrOnc.Type.CELLULAR || 111 if (device.Type != CrOnc.Type.CELLULAR ||
58 this.deviceIsEnabled_(this.deviceState)) { 112 this.deviceIsEnabled_(this.deviceState)) {
59 return false; 113 return false;
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 */ 244 */
191 onDeviceEnabledTap_: function(event) { 245 onDeviceEnabledTap_: function(event) {
192 var deviceIsEnabled = this.deviceIsEnabled_(this.deviceState); 246 var deviceIsEnabled = this.deviceIsEnabled_(this.deviceState);
193 var type = this.deviceState ? this.deviceState.Type : ''; 247 var type = this.deviceState ? this.deviceState.Type : '';
194 this.fire( 248 this.fire(
195 'device-enabled-toggled', {enabled: !deviceIsEnabled, type: type}); 249 'device-enabled-toggled', {enabled: !deviceIsEnabled, type: type});
196 // Make sure this does not propagate to onDetailsTap_. 250 // Make sure this does not propagate to onDetailsTap_.
197 event.stopPropagation(); 251 event.stopPropagation();
198 }, 252 },
199 }); 253 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698