| 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 wrapping cr-network-list including the | 6 * @fileoverview Polymer element wrapping cr-network-list including the |
| 7 * networkingPrivate calls to populate it. | 7 * networkingPrivate calls to populate it. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 Polymer({ | 10 Polymer({ |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 /** | 112 /** |
| 113 * @param {!Array<!CrOnc.NetworkStateProperties>} states | 113 * @param {!Array<!CrOnc.NetworkStateProperties>} states |
| 114 * @private | 114 * @private |
| 115 */ | 115 */ |
| 116 getNetworksCallback_: function(states) { | 116 getNetworksCallback_: function(states) { |
| 117 this.networkStateList_ = states; | 117 this.networkStateList_ = states; |
| 118 }, | 118 }, |
| 119 | 119 |
| 120 /** | 120 /** |
| 121 * Event triggered when a cr-network-list-item is selected. | 121 * Event triggered when a cr-network-list-item is selected. |
| 122 * @param {!{detail: !CrOnc.NetworkStateProperties}} event | 122 * @param {!{target: HTMLElement, detail: !CrOnc.NetworkStateProperties}} e |
| 123 * @private | 123 * @private |
| 124 */ | 124 */ |
| 125 onNetworkListItemSelected_: function(event) { | 125 onNetworkListItemSelected_: function(e) { |
| 126 var state = event.detail; | 126 var state = e.detail; |
| 127 e.target.blur(); |
| 127 | 128 |
| 128 if (!this.handleNetworkItemSelected) { | 129 if (!this.handleNetworkItemSelected) { |
| 129 this.fire('network-item-selected', state); | 130 this.fire('network-item-selected', state); |
| 130 return; | 131 return; |
| 131 } | 132 } |
| 132 | 133 |
| 133 if (state.ConnectionState != CrOnc.ConnectionState.NOT_CONNECTED) | 134 if (state.ConnectionState != CrOnc.ConnectionState.NOT_CONNECTED) |
| 134 return; | 135 return; |
| 135 | 136 |
| 136 chrome.networkingPrivate.startConnect(state.GUID, function() { | 137 chrome.networkingPrivate.startConnect(state.GUID, function() { |
| 137 var lastError = chrome.runtime.lastError; | 138 var lastError = chrome.runtime.lastError; |
| 138 if (lastError && lastError != 'connecting') | 139 if (lastError && lastError != 'connecting') |
| 139 console.error('networkingPrivate.startConnect error: ' + lastError); | 140 console.error('networkingPrivate.startConnect error: ' + lastError); |
| 140 }); | 141 }); |
| 141 }, | 142 }, |
| 142 }); | 143 }); |
| OLD | NEW |