| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // require: onc_data.js | 5 // require: onc_data.js |
| 6 | 6 |
| 7 // NOTE(stevenjb): This code is in the process of being converted to be | 7 // NOTE(stevenjb): This code is in the process of being converted to be |
| 8 // compatible with the networkingPrivate extension API: | 8 // compatible with the networkingPrivate extension API: |
| 9 // * The network property dictionaries are being converted to use ONC values. | 9 // * The network property dictionaries are being converted to use ONC values. |
| 10 // * chrome.send calls will be replaced with an API object that simulates the | 10 // * chrome.send calls will be replaced with an API object that simulates the |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1287 // Override the "automatic" values with the real saved DHCP values, | 1287 // Override the "automatic" values with the real saved DHCP values, |
| 1288 // if they are set. | 1288 // if they are set. |
| 1289 var savedNameServersString; | 1289 var savedNameServersString; |
| 1290 var savedIpAddress = onc.getActiveValue('SavedIPConfig.IPAddress'); | 1290 var savedIpAddress = onc.getActiveValue('SavedIPConfig.IPAddress'); |
| 1291 if (savedIpAddress != undefined) { | 1291 if (savedIpAddress != undefined) { |
| 1292 inetAddress.automatic = savedIpAddress; | 1292 inetAddress.automatic = savedIpAddress; |
| 1293 inetAddress.value = savedIpAddress; | 1293 inetAddress.value = savedIpAddress; |
| 1294 } | 1294 } |
| 1295 var savedPrefix = onc.getActiveValue('SavedIPConfig.RoutingPrefix'); | 1295 var savedPrefix = onc.getActiveValue('SavedIPConfig.RoutingPrefix'); |
| 1296 if (savedPrefix != undefined) { | 1296 if (savedPrefix != undefined) { |
| 1297 var savedNetmask = prefixLengthToNetmask(savedPrefix); | 1297 assert(typeof savedPrefix == 'number'); |
| 1298 var savedNetmask = prefixLengthToNetmask( |
| 1299 /** @type {number} */(savedPrefix)); |
| 1298 inetNetmask.automatic = savedNetmask; | 1300 inetNetmask.automatic = savedNetmask; |
| 1299 inetNetmask.value = savedNetmask; | 1301 inetNetmask.value = savedNetmask; |
| 1300 } | 1302 } |
| 1301 var savedGateway = onc.getActiveValue('SavedIPConfig.Gateway'); | 1303 var savedGateway = onc.getActiveValue('SavedIPConfig.Gateway'); |
| 1302 if (savedGateway != undefined) { | 1304 if (savedGateway != undefined) { |
| 1303 inetGateway.automatic = savedGateway; | 1305 inetGateway.automatic = savedGateway; |
| 1304 inetGateway.value = savedGateway; | 1306 inetGateway.value = savedGateway; |
| 1305 } | 1307 } |
| 1306 var savedNameServers = onc.getActiveValue('SavedIPConfig.NameServers'); | 1308 var savedNameServers = onc.getActiveValue('SavedIPConfig.NameServers'); |
| 1307 if (savedNameServers) { | 1309 if (savedNameServers) { |
| 1308 savedNameServers = savedNameServers.sort(); | 1310 savedNameServers = savedNameServers.sort(); |
| 1309 savedNameServersString = savedNameServers.join(','); | 1311 savedNameServersString = savedNameServers.join(','); |
| 1310 } | 1312 } |
| 1311 | 1313 |
| 1312 var ipAutoConfig = 'automatic'; | 1314 var ipAutoConfig = 'automatic'; |
| 1313 | 1315 |
| 1314 var staticNameServersString; | 1316 var staticNameServersString; |
| 1315 var staticIpAddress = onc.getActiveValue('StaticIPConfig.IPAddress'); | 1317 var staticIpAddress = onc.getActiveValue('StaticIPConfig.IPAddress'); |
| 1316 if (staticIpAddress != undefined) { | 1318 if (staticIpAddress != undefined) { |
| 1317 ipAutoConfig = 'user'; | 1319 ipAutoConfig = 'user'; |
| 1318 inetAddress.user = staticIpAddress; | 1320 inetAddress.user = staticIpAddress; |
| 1319 inetAddress.value = staticIpAddress; | 1321 inetAddress.value = staticIpAddress; |
| 1320 } | 1322 } |
| 1321 var staticPrefix = onc.getActiveValue('StaticIPConfig.RoutingPrefix'); | 1323 var staticPrefix = onc.getActiveValue('StaticIPConfig.RoutingPrefix'); |
| 1322 if (staticPrefix != undefined) { | 1324 if (staticPrefix != undefined) { |
| 1323 var staticNetmask = prefixLengthToNetmask(staticPrefix); | 1325 assert(typeof staticPrefix == 'number'); |
| 1326 var staticNetmask = prefixLengthToNetmask( |
| 1327 /** @type {number} */(staticPrefix)); |
| 1324 inetNetmask.user = staticNetmask; | 1328 inetNetmask.user = staticNetmask; |
| 1325 inetNetmask.value = staticNetmask; | 1329 inetNetmask.value = staticNetmask; |
| 1326 } | 1330 } |
| 1327 var staticGateway = onc.getActiveValue('StaticIPConfig.Gateway'); | 1331 var staticGateway = onc.getActiveValue('StaticIPConfig.Gateway'); |
| 1328 if (staticGateway != undefined) { | 1332 if (staticGateway != undefined) { |
| 1329 inetGateway.user = staticGateway; | 1333 inetGateway.user = staticGateway; |
| 1330 inetGateway.value = staticGateway; | 1334 inetGateway.value = staticGateway; |
| 1331 } | 1335 } |
| 1332 var staticNameServers = onc.getActiveValue('StaticIPConfig.NameServers'); | 1336 var staticNameServers = onc.getActiveValue('StaticIPConfig.NameServers'); |
| 1333 if (staticNameServers) { | 1337 if (staticNameServers) { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 | 1598 |
| 1595 // Don't show page name in address bar and in history to prevent people | 1599 // Don't show page name in address bar and in history to prevent people |
| 1596 // navigate here by hand and solve issue with page session restore. | 1600 // navigate here by hand and solve issue with page session restore. |
| 1597 PageManager.showPageByName('detailsInternetPage', false); | 1601 PageManager.showPageByName('detailsInternetPage', false); |
| 1598 }; | 1602 }; |
| 1599 | 1603 |
| 1600 return { | 1604 return { |
| 1601 DetailsInternetPage: DetailsInternetPage | 1605 DetailsInternetPage: DetailsInternetPage |
| 1602 }; | 1606 }; |
| 1603 }); | 1607 }); |
| OLD | NEW |