OLD | NEW |
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} */ |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 1 : | 152 1 : |
153 2; | 153 2; |
154 return this.networkStateList.length >= minlen; | 154 return this.networkStateList.length >= minlen; |
155 }, | 155 }, |
156 | 156 |
157 /** | 157 /** |
158 * @param {!Event} event The enable button event. | 158 * @param {!Event} event The enable button event. |
159 * @private | 159 * @private |
160 */ | 160 */ |
161 onShowDetailsTap_: function(event) { | 161 onShowDetailsTap_: function(event) { |
162 if (this.shouldShowList_()) | 162 if (!this.deviceIsEnabled_(this.deviceState)) { |
| 163 this.fire( |
| 164 'device-enabled-toggled', |
| 165 {enabled: true, type: this.deviceState.Type}); |
| 166 } else if (this.shouldShowList_()) { |
163 this.fire('show-networks', this.deviceState); | 167 this.fire('show-networks', this.deviceState); |
164 else if (this.activeNetworkState.GUID) | 168 } else if (this.activeNetworkState.GUID) { |
165 this.fire('show-detail', this.activeNetworkState); | 169 this.fire('show-detail', this.activeNetworkState); |
166 else if (this.networkStateList.length > 0) | 170 } else if (this.networkStateList.length > 0) { |
167 this.fire('show-detail', this.networkStateList[0]); | 171 this.fire('show-detail', this.networkStateList[0]); |
| 172 } |
168 event.stopPropagation(); | 173 event.stopPropagation(); |
169 }, | 174 }, |
170 | 175 |
171 /** | 176 /** |
172 * @return {string} | 177 * @return {string} |
173 * @private | 178 * @private |
174 */ | 179 */ |
175 getDetailsA11yString_: function() { | 180 getDetailsA11yString_: function() { |
176 if (!this.shouldShowList_()) { | 181 if (!this.shouldShowList_()) { |
177 if (this.activeNetworkState.GUID) { | 182 if (this.activeNetworkState.GUID) { |
(...skipping 12 matching lines...) Expand all Loading... |
190 */ | 195 */ |
191 onDeviceEnabledTap_: function(event) { | 196 onDeviceEnabledTap_: function(event) { |
192 var deviceIsEnabled = this.deviceIsEnabled_(this.deviceState); | 197 var deviceIsEnabled = this.deviceIsEnabled_(this.deviceState); |
193 var type = this.deviceState ? this.deviceState.Type : ''; | 198 var type = this.deviceState ? this.deviceState.Type : ''; |
194 this.fire( | 199 this.fire( |
195 'device-enabled-toggled', {enabled: !deviceIsEnabled, type: type}); | 200 'device-enabled-toggled', {enabled: !deviceIsEnabled, type: type}); |
196 // Make sure this does not propagate to onDetailsTap_. | 201 // Make sure this does not propagate to onDetailsTap_. |
197 event.stopPropagation(); | 202 event.stopPropagation(); |
198 }, | 203 }, |
199 }); | 204 }); |
OLD | NEW |