| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 var NetworkUI = (function() { | 5 var NetworkUI = (function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 // Properties to display in the network state table. Each entry can be either | 8 // Properties to display in the network state table. Each entry can be either |
| 9 // a single state field or an array of state fields. If more than one is | 9 // a single state field or an array of state fields. If more than one is |
| 10 // specified then the first non empty value is used. | 10 // specified then the first non empty value is used. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 return '_' + guid.replace(/[{}]/g, ''); | 190 return '_' + guid.replace(/[{}]/g, ''); |
| 191 }; | 191 }; |
| 192 | 192 |
| 193 /** | 193 /** |
| 194 * This callback function is triggered when visible networks are received. | 194 * This callback function is triggered when visible networks are received. |
| 195 * | 195 * |
| 196 * @param {!Array<!chrome.networkingPrivate.NetworkStateProperties>} states | 196 * @param {!Array<!chrome.networkingPrivate.NetworkStateProperties>} states |
| 197 * A list of network state information for each visible network. | 197 * A list of network state information for each visible network. |
| 198 */ | 198 */ |
| 199 var onVisibleNetworksReceived = function(states) { | 199 var onVisibleNetworksReceived = function(states) { |
| 200 /** @type {chrome.networkingPrivate.NetworkStateProperties} */ var | |
| 201 defaultState; | |
| 202 if (states.length > 0) | |
| 203 defaultState = states[0]; | |
| 204 var icon = /** @type {CrNetworkIconElement} */($('default-network-icon')); | |
| 205 if (defaultState && defaultState.Type != CrOnc.Type.VPN) { | |
| 206 $('default-network-text').textContent = | |
| 207 loadTimeData.getStringF('defaultNetworkText', | |
| 208 defaultState.Name, | |
| 209 defaultState.ConnectionState); | |
| 210 icon.networkState = defaultState; | |
| 211 } else { | |
| 212 $('default-network-text').textContent = | |
| 213 loadTimeData.getString('noNetworkText'); | |
| 214 // Show the disconnected wifi icon if there are no networks. | |
| 215 icon.networkType = CrOnc.Type.WIFI; | |
| 216 } | |
| 217 | |
| 218 createStateTable('network-state-table', NETWORK_STATE_FIELDS, states); | 200 createStateTable('network-state-table', NETWORK_STATE_FIELDS, states); |
| 219 }; | 201 }; |
| 220 | 202 |
| 221 /** | 203 /** |
| 222 * This callback function is triggered when favorite networks are received. | 204 * This callback function is triggered when favorite networks are received. |
| 223 * | 205 * |
| 224 * @param {!Array<!chrome.networkingPrivate.NetworkStateProperties>} states | 206 * @param {!Array<!chrome.networkingPrivate.NetworkStateProperties>} states |
| 225 * A list of network state information for each favorite network. | 207 * A list of network state information for each favorite network. |
| 226 */ | 208 */ |
| 227 var onFavoriteNetworksReceived = function(states) { | 209 var onFavoriteNetworksReceived = function(states) { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 document.addEventListener('DOMContentLoaded', function() { | 324 document.addEventListener('DOMContentLoaded', function() { |
| 343 $('refresh').onclick = requestNetworks; | 325 $('refresh').onclick = requestNetworks; |
| 344 setRefresh(); | 326 setRefresh(); |
| 345 requestNetworks(); | 327 requestNetworks(); |
| 346 }); | 328 }); |
| 347 | 329 |
| 348 return { | 330 return { |
| 349 getShillPropertiesResult: getShillPropertiesResult | 331 getShillPropertiesResult: getShillPropertiesResult |
| 350 }; | 332 }; |
| 351 })(); | 333 })(); |
| OLD | NEW |