Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 DetailsInternetPage.getInstance().updateControls(); | 61 DetailsInternetPage.getInstance().updateControls(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 /** | 64 /** |
| 65 * Simple helper method for converting a field to a string. It is used to | 65 * Simple helper method for converting a field to a string. It is used to |
| 66 * easily assign an empty string from fields that may be unknown or undefined. | 66 * easily assign an empty string from fields that may be unknown or undefined. |
| 67 * @param {Object} value that should be converted to a string. | 67 * @param {Object} value that should be converted to a string. |
| 68 * @return {string} the result. | 68 * @return {string} the result. |
| 69 */ | 69 */ |
| 70 function stringFromValue(value) { | 70 function stringFromValue(value) { |
| 71 return value ? String(value) : ''; | 71 return value ? String(value) : ''; |
|
pneubeck (no reviews)
2015/01/23 14:53:29
btw. this function seems weird to me.
this should
stevenjb
2015/01/23 20:25:33
Acknowledged.
| |
| 72 } | 72 } |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * @param {string} action An action to send to coreOptionsUserMetricsAction. | 75 * @param {string} action An action to send to coreOptionsUserMetricsAction. |
| 76 */ | 76 */ |
| 77 function sendChromeMetricsAction(action) { | 77 function sendChromeMetricsAction(action) { |
| 78 chrome.send('coreOptionsUserMetricsAction', [action]); | 78 chrome.send('coreOptionsUserMetricsAction', [action]); |
| 79 } | 79 } |
| 80 | 80 |
| 81 /** | 81 /** |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 | 172 |
| 173 ///////////////////////////////////////////////////////////////////////////// | 173 ///////////////////////////////////////////////////////////////////////////// |
| 174 // DetailsInternetPage class: | 174 // DetailsInternetPage class: |
| 175 | 175 |
| 176 /** | 176 /** |
| 177 * Encapsulated handling of ChromeOS internet details overlay page. | 177 * Encapsulated handling of ChromeOS internet details overlay page. |
| 178 * @constructor | 178 * @constructor |
| 179 * @extends {cr.ui.pageManager.Page} | 179 * @extends {cr.ui.pageManager.Page} |
| 180 */ | 180 */ |
| 181 function DetailsInternetPage() { | 181 function DetailsInternetPage() { |
| 182 // Cached Apn properties | 182 // If non-negative, indicates a custom entry in select-apn. |
| 183 this.userApnIndex_ = -1; | 183 this.userApnIndex_ = -1; |
| 184 | |
| 185 // The custom APN properties associated with entry |userApnIndex_|. | |
| 186 this.userApn_ = {}; | |
| 187 | |
| 188 // The currently selected APN entry (which may or may not == userApnIndex_). | |
| 184 this.selectedApnIndex_ = -1; | 189 this.selectedApnIndex_ = -1; |
| 185 this.userApn_ = {}; | 190 |
| 186 // We show the Proxy configuration tab for remembered networks and when | 191 // We show the Proxy configuration tab for remembered networks and when |
| 187 // configuring a proxy from the login screen. | 192 // configuring a proxy from the login screen. |
| 188 this.showProxy_ = false; | 193 this.showProxy_ = false; |
| 189 | 194 |
| 190 Page.call(this, 'detailsInternetPage', '', 'details-internet-page'); | 195 Page.call(this, 'detailsInternetPage', '', 'details-internet-page'); |
| 191 } | 196 } |
| 192 | 197 |
| 193 cr.addSingletonGetter(DetailsInternetPage); | 198 cr.addSingletonGetter(DetailsInternetPage); |
| 194 | 199 |
| 195 DetailsInternetPage.prototype = { | 200 DetailsInternetPage.prototype = { |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 777 typeLabel.textContent = loadTimeData.getString(typeKey); | 782 typeLabel.textContent = loadTimeData.getString(typeKey); |
| 778 typeLabel.hidden = false; | 783 typeLabel.hidden = false; |
| 779 typeSeparator.hidden = false; | 784 typeSeparator.hidden = false; |
| 780 } else { | 785 } else { |
| 781 typeLabel.hidden = true; | 786 typeLabel.hidden = true; |
| 782 typeSeparator.hidden = true; | 787 typeSeparator.hidden = true; |
| 783 } | 788 } |
| 784 }, | 789 }, |
| 785 | 790 |
| 786 /** | 791 /** |
| 787 * Helper method called from initializeDetailsPage to initialize the Apn | 792 * Helper method called from initializeApnList to populate the Apn list. |
| 788 * list. | 793 * @param {Array} apnList List of available APNs. |
| 789 * @private | 794 * @private |
| 790 */ | 795 */ |
| 791 initializeApnList_: function() { | 796 populateApnList_: function(apnList) { |
|
pneubeck (no reviews)
2015/01/23 14:53:29
nit:
the semantics of this functions would be a b
stevenjb
2015/01/23 20:25:32
If (when) I re-write this I would organize it very
| |
| 792 var onc = this.onc_; | 797 var onc = this.onc_; |
| 793 | |
| 794 var apnSelector = $('select-apn'); | 798 var apnSelector = $('select-apn'); |
| 795 // Clear APN lists, keep only last element that "other". | |
| 796 while (apnSelector.length != 1) { | |
| 797 apnSelector.remove(0); | |
| 798 } | |
| 799 var otherOption = apnSelector[0]; | 799 var otherOption = apnSelector[0]; |
|
pneubeck (no reviews)
2015/01/23 14:53:28
this only works if 'other' is the only option, thu
stevenjb
2015/01/23 20:25:33
Acknowledged. I'll add an assert.
| |
| 800 var activeApn = onc.getActiveValue('Cellular.APN.AccessPointName'); | 800 var activeApn = onc.getActiveValue('Cellular.APN.AccessPointName'); |
| 801 var activeUsername = onc.getActiveValue('Cellular.APN.Username'); | 801 var activeUsername = onc.getActiveValue('Cellular.APN.Username'); |
| 802 var activePassword = onc.getActiveValue('Cellular.APN.Password'); | 802 var activePassword = onc.getActiveValue('Cellular.APN.Password'); |
| 803 var lastGoodApn = | 803 var lastGoodApn = |
| 804 onc.getActiveValue('Cellular.LastGoodAPN.AccessPointName'); | 804 onc.getActiveValue('Cellular.LastGoodAPN.AccessPointName'); |
| 805 var lastGoodUsername = | 805 var lastGoodUsername = |
| 806 onc.getActiveValue('Cellular.LastGoodAPN.Username'); | 806 onc.getActiveValue('Cellular.LastGoodAPN.Username'); |
| 807 var lastGoodPassword = | 807 var lastGoodPassword = |
| 808 onc.getActiveValue('Cellular.LastGoodAPN.Password'); | 808 onc.getActiveValue('Cellular.LastGoodAPN.Password'); |
| 809 var apnList = onc.getActiveValue('Cellular.APNList'); | |
| 810 for (var i = 0; i < apnList.length; i++) { | 809 for (var i = 0; i < apnList.length; i++) { |
| 811 var apnDict = apnList[i]; | 810 var apnDict = apnList[i]; |
| 812 var option = document.createElement('option'); | 811 var option = document.createElement('option'); |
| 813 var localizedName = apnDict['LocalizedName']; | 812 var localizedName = apnDict['LocalizedName']; |
| 814 var name = localizedName ? localizedName : apnDict['Name']; | 813 var name = localizedName ? localizedName : apnDict['Name']; |
| 815 var accessPointName = apnDict['AccessPointName']; | 814 var accessPointName = apnDict['AccessPointName']; |
| 816 option.textContent = | 815 option.textContent = |
| 817 name ? (name + ' (' + accessPointName + ')') : accessPointName; | 816 name ? (name + ' (' + accessPointName + ')') : accessPointName; |
| 818 option.value = i; | 817 option.value = i; |
| 819 // Insert new option before "other" option. | 818 // Insert new option before 'other' option. |
| 820 apnSelector.add(option, otherOption); | 819 apnSelector.add(option, otherOption); |
| 821 if (this.selectedApnIndex_ != -1) | 820 if (this.selectedApnIndex_ != -1) |
| 822 continue; | 821 continue; |
| 823 // If this matches the active Apn, or LastGoodApn (or there is no last | 822 // If this matches the active Apn name, or LastGoodApn name (or there |
| 824 // good APN), set it as the selected Apn. | 823 // is no last good APN), set it as the selected Apn. |
| 825 if ((activeApn == accessPointName && | 824 if ((activeApn == accessPointName) || |
| 826 activeUsername == apnDict['Username'] && | 825 (!activeApn && (!lastGoodApn || lastGoodApn == accessPointName))) { |
| 827 activePassword == apnDict['Password']) || | |
| 828 (!activeApn && !lastGoodApn) || | |
| 829 (!activeApn && | |
| 830 lastGoodApn == accessPointName && | |
| 831 lastGoodUsername == apnDict['Username'] && | |
| 832 lastGoodPassword == apnDict['Password'])) { | |
| 833 this.selectedApnIndex_ = i; | 826 this.selectedApnIndex_ = i; |
|
pneubeck (no reviews)
2015/01/23 14:53:28
this indexing relies on the list initially being e
stevenjb
2015/01/23 20:25:33
Ack. handled by same assert above.
| |
| 834 } | 827 } |
| 835 } | 828 } |
| 836 if (this.selectedApnIndex_ == -1 && activeApn) { | 829 if (this.selectedApnIndex_ == -1 && activeApn) { |
| 830 this.userApn_ = activeApn; | |
| 831 // Create a 'user' entry for any active apn not in the list. | |
| 837 var activeOption = document.createElement('option'); | 832 var activeOption = document.createElement('option'); |
|
pneubeck (no reviews)
2015/01/23 14:53:28
activeOption -> userOption
stevenjb
2015/01/23 20:25:33
Done.
| |
| 838 activeOption.textContent = activeApn; | 833 activeOption.textContent = activeApn; |
| 839 activeOption.value = -1; | 834 activeOption.value = -1; |
| 835 // Add 'user' entry before 'other' option. | |
| 840 apnSelector.add(activeOption, otherOption); | 836 apnSelector.add(activeOption, otherOption); |
| 841 this.selectedApnIndex_ = apnSelector.length - 2; | 837 this.selectedApnIndex_ = apnSelector.length - 2; |
| 842 this.userApnIndex_ = this.selectedApnIndex_; | 838 this.userApnIndex_ = this.selectedApnIndex_; |
| 843 } | 839 } |
| 840 }, | |
| 841 | |
| 842 /** | |
| 843 * Helper method called from initializeDetailsPage to initialize the Apn | |
| 844 * list. | |
| 845 * @private | |
| 846 */ | |
| 847 initializeApnList_: function() { | |
| 848 this.selectedApnIndex_ = -1; | |
| 849 this.userApnIndex_ = -1; | |
| 850 | |
| 851 var onc = this.onc_; | |
| 852 var apnSelector = $('select-apn'); | |
| 853 | |
| 854 // Clear APN lists, keep only last element, 'other'. | |
| 855 while (apnSelector.length != 1) | |
|
pneubeck (no reviews)
2015/01/23 14:53:28
it's a rather fragile and harder to understand if
stevenjb
2015/01/23 20:25:33
Again, I would re-write this very differently, thi
| |
| 856 apnSelector.remove(0); | |
| 857 | |
| 858 var apnList = onc.getActiveValue('Cellular.APNList'); | |
| 859 if (apnList) { | |
| 860 // Populate the list with the existing APNs. | |
| 861 this.populateApnList_(apnList); | |
| 862 } else { | |
| 863 // Create a single 'default' entry. | |
| 864 var otherOption = apnSelector[0]; | |
|
pneubeck (no reviews)
2015/01/23 14:53:29
a whole bunch of code has to be read to understand
stevenjb
2015/01/23 20:25:33
Ditto.
| |
| 865 var activeOption = document.createElement('option'); | |
|
pneubeck (no reviews)
2015/01/23 14:53:29
nit:
activeOption -> defaultOption
stevenjb
2015/01/23 20:25:33
Done.
| |
| 866 activeOption.textContent = | |
| 867 loadTimeData.getString('cellularApnUseDefault'); | |
| 868 activeOption.value = -1; | |
| 869 apnSelector.add(activeOption, otherOption); | |
|
pneubeck (no reviews)
2015/01/23 14:53:28
to prepend add the beginning of the list:
apnSel
stevenjb
2015/01/23 20:25:33
I'm not convinced that is more clear (not that any
| |
| 870 this.selectedApnIndex_ = apnSelector.length - 2; | |
|
pneubeck (no reviews)
2015/01/23 14:53:29
length is 2 here. could be simplified to
this.se
stevenjb
2015/01/23 20:25:33
Yes... that is true here. Changed and added an ass
| |
| 871 } | |
| 844 assert(this.selectedApnIndex_ >= 0); | 872 assert(this.selectedApnIndex_ >= 0); |
| 845 apnSelector.selectedIndex = this.selectedApnIndex_; | 873 apnSelector.selectedIndex = this.selectedApnIndex_; |
| 846 updateHidden('.apn-list-view', false); | 874 updateHidden('.apn-list-view', false); |
| 847 updateHidden('.apn-details-view', true); | 875 updateHidden('.apn-details-view', true); |
| 848 }, | 876 }, |
| 849 | 877 |
| 850 /** | 878 /** |
| 879 * Helper function for setting APN properties. | |
| 880 * @param {Object} apnValue Dictionary of APN properties. | |
| 881 * @private | |
| 882 */ | |
| 883 setActiveApn_: function(apnValue) { | |
| 884 var activeApn = {}; | |
| 885 var apnName = apnValue['AccessPointName']; | |
| 886 if (apnName) { | |
| 887 activeApn['AccessPointName'] = apnName; | |
| 888 activeApn['Username'] = stringFromValue(apnValue['Username']); | |
| 889 activeApn['Password'] = stringFromValue(apnValue['Password']); | |
| 890 } | |
| 891 // Set the cached ONC data. | |
| 892 this.onc_.setProperty('Cellular.APN', activeApn); | |
| 893 // Set an ONC object with just the APN values. | |
| 894 var oncData = new OncData({}); | |
| 895 oncData.setProperty('Cellular.APN', activeApn); | |
| 896 // TODO(stevenjb): chrome.networkingPrivate.setProperties | |
| 897 chrome.send('setProperties', [this.servicePath_, oncData.getData()]); | |
| 898 }, | |
| 899 | |
| 900 /** | |
| 851 * Event Listener for the cellular-apn-use-default button. | 901 * Event Listener for the cellular-apn-use-default button. |
| 852 * @private | 902 * @private |
| 853 */ | 903 */ |
| 854 setDefaultApn_: function() { | 904 setDefaultApn_: function() { |
| 855 var onc = this.onc_; | |
| 856 var apnSelector = $('select-apn'); | 905 var apnSelector = $('select-apn'); |
| 857 | 906 |
| 907 // Remove any 'user' entry. | |
|
pneubeck (no reviews)
2015/01/23 14:53:28
nit: can there be more than one 'user' entry? if n
stevenjb
2015/01/23 20:25:33
"any" can mean that, but that's kind of subtle in
| |
| 858 if (this.userApnIndex_ != -1) { | 908 if (this.userApnIndex_ != -1) { |
| 909 assert(this.userApnIndex_ < apnSelector.length - 1); | |
| 859 apnSelector.remove(this.userApnIndex_); | 910 apnSelector.remove(this.userApnIndex_); |
| 860 this.userApnIndex_ = -1; | 911 this.userApnIndex_ = -1; |
| 861 } | 912 } |
| 862 | 913 |
| 863 var iApn = -1; | 914 var apnList = this.onc_.getActiveValue('Cellular.APNList'); |
| 864 var apnList = onc.getActiveValue('Cellular.APNList'); | 915 var iApn = (apnList != undefined && apnList.length > 0) ? 0 : -1; |
| 865 if (apnList != undefined && apnList.length > 0) { | |
| 866 iApn = 0; | |
| 867 var defaultApn = apnList[iApn]; | |
| 868 var activeApn = {}; | |
| 869 activeApn['AccessPointName'] = | |
| 870 stringFromValue(defaultApn['AccessPointName']); | |
| 871 activeApn['Username'] = stringFromValue(defaultApn['Username']); | |
| 872 activeApn['Password'] = stringFromValue(defaultApn['Password']); | |
| 873 onc.setProperty('Cellular.APN', activeApn); | |
| 874 chrome.send('setApn', [this.servicePath_, | |
| 875 activeApn['AccessPointName'], | |
| 876 activeApn['Username'], | |
| 877 activeApn['Password']]); | |
| 878 } | |
| 879 apnSelector.selectedIndex = iApn; | 916 apnSelector.selectedIndex = iApn; |
| 880 this.selectedApnIndex_ = iApn; | 917 this.selectedApnIndex_ = iApn; |
| 881 | 918 |
| 919 this.setActiveApn_({}); // Use default | |
|
pneubeck (no reviews)
2015/01/23 14:53:28
so with 'Use default' you mean the 'default' entry
stevenjb
2015/01/23 20:25:33
Done.
| |
| 920 | |
| 882 updateHidden('.apn-list-view', false); | 921 updateHidden('.apn-list-view', false); |
| 883 updateHidden('.apn-details-view', true); | 922 updateHidden('.apn-details-view', true); |
| 884 }, | 923 }, |
| 885 | 924 |
| 886 /** | 925 /** |
| 887 * Event Listener for the cellular-apn-set button. | 926 * Event Listener for the cellular-apn-set button. |
| 888 * @private | 927 * @private |
| 889 */ | 928 */ |
| 890 setApn_: function(apnValue) { | 929 setApn_: function(apnValue) { |
| 891 if (apnValue == '') | 930 if (apnValue == '') |
| 892 return; | 931 return; |
| 893 | 932 |
| 894 var onc = this.onc_; | |
| 895 var apnSelector = $('select-apn'); | 933 var apnSelector = $('select-apn'); |
| 896 | 934 |
| 897 var activeApn = {}; | 935 var activeApn = {}; |
| 898 activeApn['AccessPointName'] = stringFromValue(apnValue); | 936 activeApn['AccessPointName'] = stringFromValue(apnValue); |
| 899 activeApn['Username'] = stringFromValue($('cellular-apn-username').value); | 937 activeApn['Username'] = stringFromValue($('cellular-apn-username').value); |
| 900 activeApn['Password'] = stringFromValue($('cellular-apn-password').value); | 938 activeApn['Password'] = stringFromValue($('cellular-apn-password').value); |
| 901 onc.setProperty('Cellular.APN', activeApn); | 939 this.setActiveApn_(activeApn); |
| 940 // Set the user selected APN. | |
| 902 this.userApn_ = activeApn; | 941 this.userApn_ = activeApn; |
| 903 chrome.send('setApn', [this.servicePath_, | |
| 904 activeApn['AccessPointName'], | |
| 905 activeApn['Username'], | |
| 906 activeApn['Password']]); | |
| 907 | 942 |
| 943 // Remove any existing 'user' entry. | |
| 908 if (this.userApnIndex_ != -1) { | 944 if (this.userApnIndex_ != -1) { |
| 945 assert(this.userApnIndex_ < apnSelector.length - 1); | |
| 909 apnSelector.remove(this.userApnIndex_); | 946 apnSelector.remove(this.userApnIndex_); |
| 910 this.userApnIndex_ = -1; | 947 this.userApnIndex_ = -1; |
| 911 } | 948 } |
| 912 | 949 |
| 950 // Create a new 'user' entry with the new active apn. | |
| 913 var option = document.createElement('option'); | 951 var option = document.createElement('option'); |
| 914 option.textContent = activeApn['AccessPointName']; | 952 option.textContent = activeApn['AccessPointName']; |
| 915 option.value = -1; | 953 option.value = -1; |
| 916 option.selected = true; | 954 option.selected = true; |
| 917 apnSelector.add(option, apnSelector[apnSelector.length - 1]); | 955 apnSelector.add(option, apnSelector[apnSelector.length - 1]); |
|
pneubeck (no reviews)
2015/01/23 14:53:29
this is now putting the userOption in front of the
stevenjb
2015/01/23 20:25:33
Done... we are now deep into the grey area of almo
| |
| 918 this.userApnIndex_ = apnSelector.length - 2; | 956 this.userApnIndex_ = apnSelector.length - 2; |
| 919 this.selectedApnIndex_ = this.userApnIndex_; | 957 this.selectedApnIndex_ = this.userApnIndex_; |
| 920 | 958 |
| 921 updateHidden('.apn-list-view', false); | 959 updateHidden('.apn-list-view', false); |
| 922 updateHidden('.apn-details-view', true); | 960 updateHidden('.apn-details-view', true); |
| 923 }, | 961 }, |
| 924 | 962 |
| 925 /** | 963 /** |
| 926 * Event Listener for the cellular-apn-cancel button. | 964 * Event Listener for the cellular-apn-cancel button. |
| 927 * @private | 965 * @private |
| 928 */ | 966 */ |
| 929 cancelApn_: function() { | 967 cancelApn_: function() { |
| 930 $('select-apn').selectedIndex = this.selectedApnIndex_; | 968 this.initializeApnList_(); |
| 931 updateHidden('.apn-list-view', false); | |
| 932 updateHidden('.apn-details-view', true); | |
| 933 }, | 969 }, |
| 934 | 970 |
| 935 /** | 971 /** |
| 936 * Event Listener for the select-apn button. | 972 * Event Listener for the select-apn button. |
| 937 * @private | 973 * @private |
| 938 */ | 974 */ |
| 939 selectApn_: function() { | 975 selectApn_: function() { |
| 940 var onc = this.onc_; | 976 var onc = this.onc_; |
| 941 var apnSelector = $('select-apn'); | 977 var apnSelector = $('select-apn'); |
| 942 var apnDict; | |
| 943 if (apnSelector[apnSelector.selectedIndex].value != -1) { | 978 if (apnSelector[apnSelector.selectedIndex].value != -1) { |
| 944 var apnList = onc.getActiveValue('Cellular.APNList'); | 979 var apnList = onc.getActiveValue('Cellular.APNList'); |
| 945 var apnIndex = apnSelector.selectedIndex; | 980 var apnIndex = apnSelector.selectedIndex; |
| 946 assert(apnIndex < apnList.length); | 981 assert(apnIndex < apnList.length); |
| 947 apnDict = apnList[apnIndex]; | |
| 948 chrome.send('setApn', [this.servicePath_, | |
| 949 stringFromValue(apnDict['AccessPointName']), | |
| 950 stringFromValue(apnDict['Username']), | |
| 951 stringFromValue(apnDict['Password'])]); | |
| 952 this.selectedApnIndex_ = apnIndex; | 982 this.selectedApnIndex_ = apnIndex; |
| 983 this.setActiveApn_(apnList[apnIndex]); | |
| 953 } else if (apnSelector.selectedIndex == this.userApnIndex_) { | 984 } else if (apnSelector.selectedIndex == this.userApnIndex_) { |
| 954 apnDict = this.userApn_; | |
| 955 chrome.send('setApn', [this.servicePath_, | |
| 956 stringFromValue(apnDict['AccessPointName']), | |
| 957 stringFromValue(apnDict['Username']), | |
| 958 stringFromValue(apnDict['Password'])]); | |
| 959 this.selectedApnIndex_ = apnSelector.selectedIndex; | 985 this.selectedApnIndex_ = apnSelector.selectedIndex; |
| 960 } else { | 986 this.setActiveApn_(this.userApn_); |
| 961 $('cellular-apn').value = | 987 } else { // 'Other' |
| 962 stringFromValue(onc.getActiveValue('Cellular.APN.AccessPointName')); | 988 var apnDict; |
|
pneubeck (no reviews)
2015/01/23 14:53:28
this code is only for pre-filling some edit fields
stevenjb
2015/01/23 20:25:33
Correct.
| |
| 963 $('cellular-apn-username').value = | 989 if (this.userApn_['AccessPointName']) { |
| 964 stringFromValue(onc.getActiveValue('Cellular.APN.Username')); | 990 apnDict = this.userApn_; |
|
pneubeck (no reviews)
2015/01/23 14:53:29
this is rather confusing.
there seem to be two sta
stevenjb
2015/01/23 20:25:33
I attempted to improve this. I'll add comments, bu
pneubeck (no reviews)
2015/01/24 09:33:13
thanks for clarifying.
| |
| 965 $('cellular-apn-password').value = | 991 } else { |
| 966 stringFromValue(onc.getActiveValue('Cellular.APN.Password')); | 992 apnDict = {}; |
| 993 apnDict['AccessPointName'] = | |
| 994 onc.getActiveValue('Cellular.APN.AccessPointName'); | |
| 995 apnDict['Username'] = onc.getActiveValue('Cellular.APN.Username'); | |
| 996 apnDict['Password'] = onc.getActiveValue('Cellular.APN.Password'); | |
| 997 } | |
| 998 $('cellular-apn').value = stringFromValue(apnDict['AccessPointName']); | |
| 999 $('cellular-apn-username').value = stringFromValue(apnDict['Username']); | |
| 1000 $('cellular-apn-password').value = stringFromValue(apnDict['Password']); | |
| 967 updateHidden('.apn-list-view', true); | 1001 updateHidden('.apn-list-view', true); |
| 968 updateHidden('.apn-details-view', false); | 1002 updateHidden('.apn-details-view', false); |
| 969 } | 1003 } |
| 970 } | 1004 } |
| 971 }; | 1005 }; |
| 972 | 1006 |
| 973 /** | 1007 /** |
| 974 * Enables or Disables all buttons that provide operations on the cellular | 1008 * Enables or Disables all buttons that provide operations on the cellular |
| 975 * network. | 1009 * network. |
| 976 */ | 1010 */ |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1652 | 1686 |
| 1653 // Don't show page name in address bar and in history to prevent people | 1687 // Don't show page name in address bar and in history to prevent people |
| 1654 // navigate here by hand and solve issue with page session restore. | 1688 // navigate here by hand and solve issue with page session restore. |
| 1655 PageManager.showPageByName('detailsInternetPage', false); | 1689 PageManager.showPageByName('detailsInternetPage', false); |
| 1656 }; | 1690 }; |
| 1657 | 1691 |
| 1658 return { | 1692 return { |
| 1659 DetailsInternetPage: DetailsInternetPage | 1693 DetailsInternetPage: DetailsInternetPage |
| 1660 }; | 1694 }; |
| 1661 }); | 1695 }); |
| OLD | NEW |