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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 // blank if the network is not connected. | 452 // blank if the network is not connected. |
453 $('ipconfig-section').hidden = false; | 453 $('ipconfig-section').hidden = false; |
454 $('ipconfig-dns-section').hidden = false; | 454 $('ipconfig-dns-section').hidden = false; |
455 | 455 |
456 // Network type related. | 456 // Network type related. |
457 updateHidden('#details-internet-page .cellular-details', | 457 updateHidden('#details-internet-page .cellular-details', |
458 this.type_ != 'Cellular'); | 458 this.type_ != 'Cellular'); |
459 updateHidden('#details-internet-page .wifi-details', | 459 updateHidden('#details-internet-page .wifi-details', |
460 this.type_ != 'WiFi'); | 460 this.type_ != 'WiFi'); |
461 updateHidden('#details-internet-page .wimax-details', | 461 updateHidden('#details-internet-page .wimax-details', |
462 this.type_ != 'Wimax'); | 462 this.type_ != 'WiMAX'); |
463 updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN'); | 463 updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN'); |
464 updateHidden('#details-internet-page .proxy-details', !this.showProxy_); | 464 updateHidden('#details-internet-page .proxy-details', !this.showProxy_); |
465 | 465 |
466 // Cellular | 466 // Cellular |
467 if (this.type_ == 'Cellular') { | 467 if (this.type_ == 'Cellular') { |
468 // Hide gsm/cdma specific elements. | 468 // Hide gsm/cdma specific elements. |
469 if (onc.getActiveValue('Cellular.Family') == 'GSM') | 469 if (onc.getActiveValue('Cellular.Family') == 'GSM') |
470 updateHidden('#details-internet-page .cdma-only', true); | 470 updateHidden('#details-internet-page .cdma-only', true); |
471 else | 471 else |
472 updateHidden('#details-internet-page .gsm-only', true); | 472 updateHidden('#details-internet-page .gsm-only', true); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 $('details-internet-login').disabled = false; | 635 $('details-internet-login').disabled = false; |
636 $('details-internet-disconnect').hidden = true; | 636 $('details-internet-disconnect').hidden = true; |
637 } else { | 637 } else { |
638 $('details-internet-login').hidden = true; | 638 $('details-internet-login').hidden = true; |
639 $('details-internet-disconnect').hidden = false; | 639 $('details-internet-disconnect').hidden = false; |
640 } | 640 } |
641 | 641 |
642 var connectable = onc.getActiveValue('Connectable'); | 642 var connectable = onc.getActiveValue('Connectable'); |
643 if (connectState != 'Connected' && | 643 if (connectState != 'Connected' && |
644 (!connectable || onc.getWiFiSecurity() != 'None' || | 644 (!connectable || onc.getWiFiSecurity() != 'None' || |
645 (this.type_ == 'Wimax' || this.type_ == 'VPN'))) { | 645 (this.type_ == 'WiMAX' || this.type_ == 'VPN'))) { |
646 $('details-internet-configure').hidden = false; | 646 $('details-internet-configure').hidden = false; |
647 } else { | 647 } else { |
648 $('details-internet-configure').hidden = true; | 648 $('details-internet-configure').hidden = true; |
649 } | 649 } |
650 }, | 650 }, |
651 | 651 |
652 /** | 652 /** |
653 * Helper method called from showDetailedInfo and updateConnectionData. | 653 * Helper method called from showDetailedInfo and updateConnectionData. |
654 * Updates the connection state property and account / sim card links. | 654 * Updates the connection state property and account / sim card links. |
655 * @private | 655 * @private |
656 */ | 656 */ |
657 updateDetails_: function() { | 657 updateDetails_: function() { |
658 var onc = this.onc_; | 658 var onc = this.onc_; |
659 | 659 |
660 var connectionStateString = onc.getTranslatedValue('ConnectionState'); | 660 var connectionStateString = onc.getTranslatedValue('ConnectionState'); |
661 $('connection-state').textContent = connectionStateString; | 661 $('connection-state').textContent = connectionStateString; |
662 | 662 |
663 var type = this.type_; | 663 var type = this.type_; |
664 var showViewAccount = false; | 664 var showViewAccount = false; |
665 var showActivate = false; | 665 var showActivate = false; |
666 if (type == 'WiFi') { | 666 if (type == 'WiFi') { |
667 $('wifi-connection-state').textContent = connectionStateString; | 667 $('wifi-connection-state').textContent = connectionStateString; |
668 } else if (type == 'Wimax') { | 668 } else if (type == 'WiMAX') { |
669 $('wimax-connection-state').textContent = connectionStateString; | 669 $('wimax-connection-state').textContent = connectionStateString; |
670 } else if (type == 'Cellular') { | 670 } else if (type == 'Cellular') { |
671 $('activation-state').textContent = | 671 $('activation-state').textContent = |
672 onc.getTranslatedValue('Cellular.ActivationState'); | 672 onc.getTranslatedValue('Cellular.ActivationState'); |
673 if (onc.getActiveValue('Cellular.Family') == 'GSM') { | 673 if (onc.getActiveValue('Cellular.Family') == 'GSM') { |
674 var lockEnabled = | 674 var lockEnabled = |
675 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); | 675 onc.getActiveValue('Cellular.SIMLockStatus.LockEnabled'); |
676 $('sim-card-lock-enabled').checked = lockEnabled; | 676 $('sim-card-lock-enabled').checked = lockEnabled; |
677 $('change-pin').hidden = !lockEnabled; | 677 $('change-pin').hidden = !lockEnabled; |
678 } | 678 } |
(...skipping 22 matching lines...) Expand all Loading... |
701 var connectionState = onc.getActiveValue('ConnectionState'); | 701 var connectionState = onc.getActiveValue('ConnectionState'); |
702 var connectionStateString = onc.getTranslatedValue('ConnectionState'); | 702 var connectionStateString = onc.getTranslatedValue('ConnectionState'); |
703 $('network-details-subtitle-status').textContent = connectionStateString; | 703 $('network-details-subtitle-status').textContent = connectionStateString; |
704 | 704 |
705 var typeKey; | 705 var typeKey; |
706 var type = this.type_; | 706 var type = this.type_; |
707 if (type == 'Ethernet') | 707 if (type == 'Ethernet') |
708 typeKey = 'ethernetTitle'; | 708 typeKey = 'ethernetTitle'; |
709 else if (type == 'WiFi') | 709 else if (type == 'WiFi') |
710 typeKey = 'wifiTitle'; | 710 typeKey = 'wifiTitle'; |
711 else if (type == 'Wimax') | 711 else if (type == 'WiMAX') |
712 typeKey = 'wimaxTitle'; | 712 typeKey = 'wimaxTitle'; |
713 else if (type == 'Cellular') | 713 else if (type == 'Cellular') |
714 typeKey = 'cellularTitle'; | 714 typeKey = 'cellularTitle'; |
715 else if (type == 'VPN') | 715 else if (type == 'VPN') |
716 typeKey = 'vpnTitle'; | 716 typeKey = 'vpnTitle'; |
717 else | 717 else |
718 typeKey = null; | 718 typeKey = null; |
719 var typeLabel = $('network-details-subtitle-type'); | 719 var typeLabel = $('network-details-subtitle-type'); |
720 var typeSeparator = $('network-details-subtitle-separator'); | 720 var typeSeparator = $('network-details-subtitle-separator'); |
721 if (typeKey) { | 721 if (typeKey) { |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1067 var servicePath = detailsPage.servicePath_; | 1067 var servicePath = detailsPage.servicePath_; |
1068 if (type == 'WiFi') { | 1068 if (type == 'WiFi') { |
1069 sendCheckedIfEnabled(servicePath, | 1069 sendCheckedIfEnabled(servicePath, |
1070 'setPreferNetwork', | 1070 'setPreferNetwork', |
1071 'prefer-network-wifi', | 1071 'prefer-network-wifi', |
1072 'Options_NetworkSetPrefer'); | 1072 'Options_NetworkSetPrefer'); |
1073 sendCheckedIfEnabled(servicePath, | 1073 sendCheckedIfEnabled(servicePath, |
1074 'setAutoConnect', | 1074 'setAutoConnect', |
1075 'auto-connect-network-wifi', | 1075 'auto-connect-network-wifi', |
1076 'Options_NetworkAutoConnect'); | 1076 'Options_NetworkAutoConnect'); |
1077 } else if (type == 'Wimax') { | 1077 } else if (type == 'WiMAX') { |
1078 sendCheckedIfEnabled(servicePath, | 1078 sendCheckedIfEnabled(servicePath, |
1079 'setAutoConnect', | 1079 'setAutoConnect', |
1080 'auto-connect-network-wimax', | 1080 'auto-connect-network-wimax', |
1081 'Options_NetworkAutoConnect'); | 1081 'Options_NetworkAutoConnect'); |
1082 } else if (type == 'Cellular') { | 1082 } else if (type == 'Cellular') { |
1083 sendCheckedIfEnabled(servicePath, | 1083 sendCheckedIfEnabled(servicePath, |
1084 'setAutoConnect', | 1084 'setAutoConnect', |
1085 'auto-connect-network-cellular', | 1085 'auto-connect-network-cellular', |
1086 'Options_NetworkAutoConnect'); | 1086 'Options_NetworkAutoConnect'); |
1087 } else if (type == 'VPN') { | 1087 } else if (type == 'VPN') { |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 if (property != undefined) { | 1389 if (property != undefined) { |
1390 $(field).textContent = property; | 1390 $(field).textContent = property; |
1391 $(field).parentElement.hidden = false; | 1391 $(field).parentElement.hidden = false; |
1392 } else { | 1392 } else { |
1393 $(field).parentElement.hidden = true; | 1393 $(field).parentElement.hidden = true; |
1394 } | 1394 } |
1395 }; | 1395 }; |
1396 | 1396 |
1397 var networkName = onc.getTranslatedValue('Name'); | 1397 var networkName = onc.getTranslatedValue('Name'); |
1398 | 1398 |
1399 // Signal strength as percentage (for WiFi and Wimax). | 1399 // Signal strength as percentage (for WiFi and WiMAX). |
1400 var signalStrength; | 1400 var signalStrength; |
1401 if (type == 'WiFi' || type == 'Wimax') | 1401 if (type == 'WiFi' || type == 'WiMAX') |
1402 signalStrength = onc.getActiveValue(type + '.SignalStrength'); | 1402 signalStrength = onc.getActiveValue(type + '.SignalStrength'); |
1403 if (!signalStrength) | 1403 if (!signalStrength) |
1404 signalStrength = 0; | 1404 signalStrength = 0; |
1405 var strengthFormat = loadTimeData.getString('inetSignalStrengthFormat'); | 1405 var strengthFormat = loadTimeData.getString('inetSignalStrengthFormat'); |
1406 var strengthString = strengthFormat.replace('$1', signalStrength); | 1406 var strengthString = strengthFormat.replace('$1', signalStrength); |
1407 | 1407 |
1408 if (type == 'WiFi') { | 1408 if (type == 'WiFi') { |
1409 OptionsPage.showTab($('wifi-network-nav-tab')); | 1409 OptionsPage.showTab($('wifi-network-nav-tab')); |
1410 $('wifi-restricted-connectivity').textContent = restrictedString; | 1410 $('wifi-restricted-connectivity').textContent = restrictedString; |
1411 var ssid = onc.getActiveValue('WiFi.SSID'); | 1411 var ssid = onc.getActiveValue('WiFi.SSID'); |
(...skipping 12 matching lines...) Expand all Loading... |
1424 $('wifi-frequency').textContent = frequencyFormat; | 1424 $('wifi-frequency').textContent = frequencyFormat; |
1425 $('wifi-signal-strength').textContent = strengthString; | 1425 $('wifi-signal-strength').textContent = strengthString; |
1426 setOrHideParent('wifi-hardware-address', | 1426 setOrHideParent('wifi-hardware-address', |
1427 onc.getActiveValue('MacAddress')); | 1427 onc.getActiveValue('MacAddress')); |
1428 var priority = onc.getActiveValue('Priority'); | 1428 var priority = onc.getActiveValue('Priority'); |
1429 $('prefer-network-wifi').checked = priority > 0; | 1429 $('prefer-network-wifi').checked = priority > 0; |
1430 $('prefer-network-wifi').disabled = !remembered; | 1430 $('prefer-network-wifi').disabled = !remembered; |
1431 $('auto-connect-network-wifi').checked = | 1431 $('auto-connect-network-wifi').checked = |
1432 onc.getActiveValue('WiFi.AutoConnect'); | 1432 onc.getActiveValue('WiFi.AutoConnect'); |
1433 $('auto-connect-network-wifi').disabled = !remembered; | 1433 $('auto-connect-network-wifi').disabled = !remembered; |
1434 } else if (type == 'Wimax') { | 1434 } else if (type == 'WiMAX') { |
1435 OptionsPage.showTab($('wimax-network-nav-tab')); | 1435 OptionsPage.showTab($('wimax-network-nav-tab')); |
1436 $('wimax-restricted-connectivity').textContent = restrictedString; | 1436 $('wimax-restricted-connectivity').textContent = restrictedString; |
1437 | 1437 |
1438 $('auto-connect-network-wimax').checked = | 1438 $('auto-connect-network-wimax').checked = |
1439 onc.getActiveValue('Wimax.AutoConnect'); | 1439 onc.getActiveValue('WiMAX.AutoConnect'); |
1440 $('auto-connect-network-wimax').disabled = !remembered; | 1440 $('auto-connect-network-wimax').disabled = !remembered; |
1441 var identity = onc.getActiveValue('Wimax.EAP.Identity'); | 1441 var identity = onc.getActiveValue('WiMAX.EAP.Identity'); |
1442 setOrHideParent('wimax-eap-identity', identity); | 1442 setOrHideParent('wimax-eap-identity', identity); |
1443 $('wimax-signal-strength').textContent = strengthString; | 1443 $('wimax-signal-strength').textContent = strengthString; |
1444 } else if (type == 'Cellular') { | 1444 } else if (type == 'Cellular') { |
1445 OptionsPage.showTab($('cellular-conn-nav-tab')); | 1445 OptionsPage.showTab($('cellular-conn-nav-tab')); |
1446 | 1446 |
1447 var isGsm = onc.getActiveValue('Cellular.Family') == 'GSM'; | 1447 var isGsm = onc.getActiveValue('Cellular.Family') == 'GSM'; |
1448 | 1448 |
1449 var currentCarrierIndex = -1; | 1449 var currentCarrierIndex = -1; |
1450 if (this.showCarrierSelect_) { | 1450 if (this.showCarrierSelect_) { |
1451 var currentCarrier = | 1451 var currentCarrier = |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 | 1588 |
1589 // Don't show page name in address bar and in history to prevent people | 1589 // Don't show page name in address bar and in history to prevent people |
1590 // navigate here by hand and solve issue with page session restore. | 1590 // navigate here by hand and solve issue with page session restore. |
1591 PageManager.showPageByName('detailsInternetPage', false); | 1591 PageManager.showPageByName('detailsInternetPage', false); |
1592 }; | 1592 }; |
1593 | 1593 |
1594 return { | 1594 return { |
1595 DetailsInternetPage: DetailsInternetPage | 1595 DetailsInternetPage: DetailsInternetPage |
1596 }; | 1596 }; |
1597 }); | 1597 }); |
OLD | NEW |