| 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 | 6 * @fileoverview |
| 7 * 'settings-internet-known-networks' is the settings subpage listing the | 7 * 'settings-internet-known-networks' is the settings subpage listing the |
| 8 * known networks for a type (currently always WiFi). | 8 * known networks for a type (currently always WiFi). |
| 9 */ | 9 */ |
| 10 Polymer({ | 10 Polymer({ |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 onMenuButtonTap_: function(event) { | 147 onMenuButtonTap_: function(event) { |
| 148 var button = /** @type {!HTMLElement} */ (event.target); | 148 var button = /** @type {!HTMLElement} */ (event.target); |
| 149 this.selectedGuid_ = | 149 this.selectedGuid_ = |
| 150 /** @type {!{model: !{item: !CrOnc.NetworkStateProperties}}} */ (event) | 150 /** @type {!{model: !{item: !CrOnc.NetworkStateProperties}}} */ (event) |
| 151 .model.item.GUID; | 151 .model.item.GUID; |
| 152 // We need to make a round trip to Chrome in order to retrieve the managed | 152 // We need to make a round trip to Chrome in order to retrieve the managed |
| 153 // properties for the network. The delay is not noticeable (~5ms) and is | 153 // properties for the network. The delay is not noticeable (~5ms) and is |
| 154 // preferable to initiating a query for every known network at load time. | 154 // preferable to initiating a query for every known network at load time. |
| 155 this.networkingPrivate.getManagedProperties( | 155 this.networkingPrivate.getManagedProperties( |
| 156 this.selectedGuid_, function(properties) { | 156 this.selectedGuid_, function(properties) { |
| 157 if (chrome.runtime.lastError || !properties) { |
| 158 this.showAddPreferred_ = false; |
| 159 this.showRemovePreferred_ = false; |
| 160 return; |
| 161 } |
| 157 var preferred = button.hasAttribute('preferred'); | 162 var preferred = button.hasAttribute('preferred'); |
| 158 if (this.isNetworkPolicyEnforced(properties.Priority)) { | 163 if (this.isNetworkPolicyEnforced(properties.Priority)) { |
| 159 this.showAddPreferred_ = false; | 164 this.showAddPreferred_ = false; |
| 160 this.showRemovePreferred_ = false; | 165 this.showRemovePreferred_ = false; |
| 161 } else { | 166 } else { |
| 162 this.showAddPreferred_ = !preferred; | 167 this.showAddPreferred_ = !preferred; |
| 163 this.showRemovePreferred_ = preferred; | 168 this.showRemovePreferred_ = preferred; |
| 164 } | 169 } |
| 165 /** @type {!CrActionMenuElement} */ (this.$.dotsMenu).showAt(button); | 170 /** @type {!CrActionMenuElement} */ (this.$.dotsMenu).showAt(button); |
| 166 }.bind(this)); | 171 }.bind(this)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 192 * @private | 197 * @private |
| 193 */ | 198 */ |
| 194 fireShowDetails_: function(event) { | 199 fireShowDetails_: function(event) { |
| 195 var state = | 200 var state = |
| 196 /** @type {!{model: !{item: !CrOnc.NetworkStateProperties}}} */ (event) | 201 /** @type {!{model: !{item: !CrOnc.NetworkStateProperties}}} */ (event) |
| 197 .model.item; | 202 .model.item; |
| 198 this.fire('show-detail', state); | 203 this.fire('show-detail', state); |
| 199 event.stopPropagation(); | 204 event.stopPropagation(); |
| 200 }, | 205 }, |
| 201 }); | 206 }); |
| OLD | NEW |